找不到Django管理模板

时间:2013-11-04 14:48:07

标签: django django-admin

突然django admin无法找到登录模板。 访问/ admin /时会引发TemplateDoesNotExist

奇怪的是,它搜索admin/login.html.html,显然,在提供的任何路径中都不存在。

知道在哪里添加额外的.html

修改

url.py:

from django.conf.urls import patterns, include, url
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', include('dashboard.urls')),
)

回溯:

Internal Server Error: /admin/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 140, in get_response
    response = response.render()
  File "/usr/local/lib/python2.7/dist-packages/django/template/response.py", line 105, in render
    self.content = self.rendered_content
  File "/usr/local/lib/python2.7/dist-packages/django/template/response.py", line 80, in rendered_content
    template = self.resolve_template(self.template_name)
  File "/usr/local/lib/python2.7/dist-packages/django/template/response.py", line 58, in resolve_template
    return loader.get_template(template)
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", line 146, in get_template
    template, origin = find_template(template_name)
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", line 139, in find_template
    raise TemplateDoesNotExist(name)
TemplateDoesNotExist: admin/login.html.html
[04/Nov/2013 16:55:11] "GET /admin/ HTTP/1.1" 500 74150

Core是包含settings.py,urls.py和models.py(核心模型,项目范围)的模块

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'core',
    'dashboard',
    'south',
)

1 个答案:

答案 0 :(得分:1)

似乎同事已经添加了应该使用模板加载器来处理RESTful请求和混乱的中间件。所以有问题。