Template path for new admin doc broken in revision 8520?

151 views
Skip to first unread message

Ulf Kronman

unread,
Aug 24, 2008, 9:28:19 AM8/24/08
to Django users
Hi all,
some time ago, I noticed that I got an error when I clicked on the
link to Documentation in the Django admin.

I also saw that admin docs had been moved from
/django/contrib/admin/templates/admin_doc/
to
/django/contrib/admindocs/templates/admin_doc/
but some part of my Django installation was still trying to get a
template from /django/contrib/admin/templates/admin_doc/

Today, I installed revision 8520 and notice that the error is still
there. This is what I get when I click on the Documentation link in my
Django admin (in my case leading to http://localhost/vr/admin/doc/):

----------------------------------------------------
TemplateDoesNotExist at /vr/admin/doc/

admin_doc/index.html

Request Method: GET
Request URL: http://localhost/vr/admin/doc/
Exception Type: TemplateDoesNotExist
Exception Value:

admin_doc/index.html

Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/
lib/python2.5/site-packages/django/template/loader.py in
find_template_source, line 73
-----------------------------------------------------

And in the report for template searching I see the following:
----------------------------------------------------
Using loader
django.template.loaders.app_directories.load_template_source:

* /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/contrib/admin/templates/admin_doc/index.html
(File does not exist)
--------------------------------------------------------

As you see some part of the code is looking for the admin index
template in:
/django/contrib/admin/templates/admin_doc/index.html
instead of:
/django/contrib/admindocs/templates/admin_doc/index.html

Am I alone with this problem?

Traceback listed below.

Regards
Ulf

---------------------------------------
Environment:

Request Method: GET
Request URL: http://localhost/vr/admin/doc/
Django Version: 1.0-beta_1-SVN-8520
Python Version: 2.5.1
Installed Applications:
['vr.isi',
'vr.org',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware')

Template Loader Error:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.load_template_source:
/var/local/web/vr/templates/admin_doc/index.html (File does not exist)
/Users/ulf/web/vr/templates/admin_doc/index.html (File does not exist)
Using loader
django.template.loaders.app_directories.load_template_source:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/django/contrib/admin/templates/admin_doc/index.html (File
does not exist)

Traceback:
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/handlers/base.py" in get_response
86. response = callback(request, *callback_args,
**callback_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/contrib/admin/views/decorators.py" in _checklogin
61. return view_func(request, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/contrib/admindocs/views.py" in doc_index
29. }, context_instance=RequestContext(request))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/shortcuts/__init__.py" in render_to_response
18. return HttpResponse(loader.render_to_string(*args,
**kwargs), **httpresponse_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/loader.py" in render_to_string
102. t = get_template(template_name)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/loader.py" in get_template
80. source, origin = find_template_source(template_name)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/loader.py" in find_template_source
73. raise TemplateDoesNotExist, name

Exception Type: TemplateDoesNotExist at /vr/admin/doc/
Exception Value: admin_doc/index.html

Shadow

unread,
Aug 24, 2008, 10:27:41 AM8/24/08
to Django users
Hi, not an expert!

but I think I had this same problem. The admin docs were fairly
recently moved into a separate app. So you'll need to update your urls
to something like:
--------------------------------------------------------------------------------------------------------------
from django.conf.urls.defaults import *
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
# Admin
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/(.*)', admin.site.root),
)
--------------------------------------------------------------------------------------------------------------

I think that's right?

Karen Tracey

unread,
Aug 24, 2008, 11:36:05 AM8/24/08
to django...@googlegroups.com

You need that in urls.py,  plus you need  'django.contrib.admindocs' added to your INSTALLED_APPS.  There's a ticket open (http://code.djangoproject.com/ticket/8496) for getting this last bit mentioned somewhere in the docs, at the moment I don't believe it's mentioned anywhere.

Karen
 

Shadow

unread,
Aug 24, 2008, 11:41:52 AM8/24/08
to Django users
Are yes, that too ;)

On Aug 25, 1:36 am, "Karen Tracey" <kmtra...@gmail.com> wrote:

Ulf Kronman

unread,
Aug 24, 2008, 2:18:53 PM8/24/08
to Django users
Thanks Karen and Shadow,

> > > urlpatterns = patterns('',
> > >    # Admin
> > >    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
> > >    (r'^admin/(.*)', admin.site.root),
> > > )

> > You need that in urls.py,  plus you need  'django.contrib.admindocs' added
> > to your INSTALLED_APPS.  There's a ticket open (http://code.djangoproject.com/ticket/8496) for getting this last bit
> > mentioned somewhere in the docs, at the moment I don't believe it's
> > mentioned anywhere.

I had the urlpatterns mentioned by Shadow already installed, but I
missed the django.contrib.admindocs app that Karen mentioned.

I have installed the admindocs app now, and admin docs are working
fine for me again.

Thanks for quick help,
Ulf

Eric VW

unread,
Aug 25, 2008, 9:21:13 AM8/25/08
to Django users
I opened the ticket and I have a patch out there to fix the problem.
The real problem is 'django.contrib.admindocs' doesn't really deserve
its own contrib app page in the documents. It is more of a helper
application than anything. It just needs to be enabled via
INSTALLED_APPS and adding a one-liner in the urls.py when you open a
project would seem like a suitable location.
> I have installed the admindocs app now, andadmindocs are working
Reply all
Reply to author
Forward
0 new messages