Django管理员在升级到1.8.1后就会中断 [英] Django admin breaks after upgrading to 1.8.1

查看:121
本文介绍了Django管理员在升级到1.8.1后就会中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从1.7.3升级到1.8.1,我的管理员不工作,因为在解决路径时失败,因此网站没有加载。

I upgraded from 1.7.3 to 1.8.1, and my admin is not working and the site is not loading because it fails while resolving paths.

异常:

Enable 'django.contrib.auth.context_processors.auth' in your TEMPLATES setting in order to use the admin application.

这是栈跟踪:

Environment:


Request Method: GET
Request URL: 

Django Version: 1.8.1
Python Version: 2.7.8
Installed Applications:
('django.contrib.admin',
 ..)
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 ..)


Traceback:
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  119.                 resolver_match = resolver.resolve(request.path_info)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
  366.             for pattern in self.url_patterns:
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
  402.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
  396.             self._urlconf_module = import_module(self.urlconf_name)
File "/app/.heroku/python/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)
File "/app/appname/urls.py" in <module>
  72.     url(r'^tarantino/', include(admin.site.urls)),
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/sites.py" in urls
  291.         return self.get_urls(), 'admin', self.name
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/sites.py" in get_urls
  250.             self.check_dependencies()
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/sites.py" in check_dependencies
  194.                     "Enable 'django.contrib.auth.context_processors.auth' "

Exception Type: ImproperlyConfigured at /
Exception Value: Enable 'django.contrib.auth.context_processors.auth' in your TEMPLATES setting in order to use the admin application.

我有'django.contrib.auth.context_processors.auth <我的 TEMPLATE_CONTEXT_PROCESSORS 中的code>已经不知道为什么现在发生这种情况?

I do have 'django.contrib.auth.context_processors.auth in my TEMPLATE_CONTEXT_PROCESSORS already so no sure why is this happening now?

推荐答案

已删除 TEMPLATE_CONTEXT_PROCESSORS ,并替换为Django 1.8中的 TEMPLATES 设置。

The TEMPLATE_CONTEXT_PROCESSORS was removed, and replaced with the TEMPLATES setting in Django 1.8.

您将必须根据此指南修改您的设置,通过删除旧的 TEMPLATE_CONTEXT_PROCESSORS TEMPLATE_DIRS 设置:

You will have to modify your settings according to this guide, by removing the old TEMPLATE_CONTEXT_PROCESSORS and TEMPLATE_DIRS settings with:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

这篇关于Django管理员在升级到1.8.1后就会中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆