Hello,

I tried enabling the admin_doc system in Django 1.3.1 and I got a
TemplateDoesNotExist exception as follows:

[CUT]
TemplateDoesNotExist at /admin/doc/

admin_doc/missing_docutils.html

Request Method:         GET
Request URL:    http://127.0.0.1:8000/admin/doc/
Django Version:         1.3.1
Exception Type:         TemplateDoesNotExist
Exception Value:

admin_doc/missing_docutils.html

Exception Location:     C:\users\Piper\projs\pystuff\lib\site-packages
\django\template\loader.py in find_template, line 138
Python Executable:      C:\users\Piper\projs\pystuff\Scripts\python.exe
Python Version:         2.7.1
[/CUT]


My urls.py has the following:
[CUT]
urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'cms.views.home', name='home'),
    # url(r'^cms/', include('cms.foo.urls')),

    # Uncomment the admin/doc line below to enable admin
documentation:
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'', include('django.contrib.flatpages.urls')),

)
[/CUT]


And settings.py has the following in the templates section:

[CUT]
# List of callables that know how to import templates from various
sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

# more settings... and later:

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/
django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.

    os.path.join(PROJECT_DIR, 'templates'),
)
[/CUT]


where PROJECT_DIR = os.path.dirname(__file__) and that is set earlier
in top of the settings file.

Some of the details of the TemplateDoesNotExist exception reported
above are as follows:

[CUT]
Server time:    Thu, 15 Sep 2011 21:57:58 +0300
Template-loader postmortem

Django tried loading these templates, in this order:

    Using loader django.template.loaders.filesystem.Loader:
        c:\users\Piper\projs\djprojs\cms\templates\admin_doc
\missing_docutils.html (File does not exist)
    Using loader django.template.loaders.app_directories.Loader:
        c:\users\Piper\projs\pystuff\lib\site-packages\django\contrib
\admin\templates\admin_doc\missing_docutils.html (File does not exist)
[/CUT]


I understand that the first location Django tries is the path I gave
in the settings file for my project's own templates, but the second
location that Django tries seems odd to me.

The actual template directory (and actual file) is in
contrib.admindocs:
C:\Users\Piper\projs\pystuff\Lib\site-packages\django\contrib\admindocs
\templates\admin_doc

Not in the subdirectory of contrib.admin:
c:\users\Piper\projs\pystuff\lib\site-packages\django\contrib\admin
\templates\admin_doc\


Why is Django searching the admin subdirectory instead of admindocs'
for the templates of the latter? Any thoughts?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to