简体   繁体   English

找不到Django管理模板

[英]Django admin template not found

Suddenly django admin couldn't find login template. django管理员突然找不到登录模板。 When accessing /admin/ it raises TemplateDoesNotExist . 访问/ admin /时会引发TemplateDoesNotExist

Strange thing is that it searches for admin/login.html.html that, obviously, does not exist in any of paths supplied. 奇怪的是,它搜索的admin/login.html.html很显然在提供的任何路径中都不存在。

Any idea where does it add the extra .html ? 知道在哪里添加额外的.html吗?

EDIT: 编辑:

url.py: 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')),
)

Traceback: 追溯:

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 is the module that contains settings.py, urls.py and models.py (core models, that are project-wide) 核心是包含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',
)

Appears that coworkers had added middleware that should handle RESTful requests and messes with the template loader. 看来同事已经添加了中间件,该中间件应处理RESTful请求并与模板加载器混淆。 So there was the problem. 因此存在问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM