AttributeError:' NoneType'对象没有属性'标签' - 将Django升级到1.6.5

时间:2014-08-13 17:28:23

标签: python django

我正在尝试将旧项目从 Django 1.4 升级到 Django 1.7 ,我正在按版本进行升级。我设法在 1.5.8 中使其工作正常,但在 1.6.5 我无法通过以下错误(错误也出现在最新的 1.7c2 ):

mod_wsgi (pid=2364): Exception occurred processing WSGI script '/home/dev/web/project_dir/wsgi/dev/dev-project-local.wsgi'.
Traceback (most recent call last):
  File "/home/dev/.envs/project_env/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 206, in __call__
    response = self.get_response(request)
  File "/home/dev/.envs/project_env/lib/python2.7/site-packages/django/core/handlers/base.py", line 146, in get_response
    response = debug.technical_404_response(request, e)
  File "/home/dev/.envs/project_env/lib/python2.7/site-packages/django/views/debug.py", line 481, in technical_404_response
    t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template')
  File "/home/dev/.envs/project_env/lib/python2.7/site-packages/django/template/base.py", line 125, in __init__
    self.nodelist = compile_string(template_string, origin)
  File "/home/dev/.envs/project_env/lib/python2.7/site-packages/django/template/base.py", line 152, in compile_string
    parser = parser_class(lexer.tokenize())
  File "/home/dev/.envs/project_env/lib/python2.7/site-packages/django/template/base.py", line 239, in __init__
    self.add_library(lib)
  File "/home/dev/.envs/project_env/lib/python2.7/site-packages/django/template/base.py", line 353, in add_library
    self.tags.update(lib.tags)
AttributeError: 'NoneType' object has no attribute 'tags'

什么可能导致此错误,我应该在哪里寻找问题?

使用Python 2.7.3,mod_wsgi,apache。

由于

1 个答案:

答案 0 :(得分:1)

这是由我的项目加载的已弃用django.contrib.markup.templatetags.markup引起的。它似乎没有在任何地方使用,因此在删除后,页面开始正常工作。