0

突然 django admin 找不到登录模板。访问 /admin/ 时,它会引发TemplateDoesNotExist.

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

知道它在哪里添加了额外的.html吗?

编辑:

网址.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

核心是包含 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',
)
4

1 回答 1

1

似乎同事已经添加了应该处理 RESTful 请求并与模板加载器混淆的中间件。所以问题就来了。

于 2013-11-05T08:19:16.010 回答