/ admin /中的VariableDoesNotExist

时间:2015-11-21 21:44:46

标签: python django mezzanine

尝试访问我的博客或/admin页面时收到一个非常奇怪的错误。

VariableDoesNotExist at /admin/

模板渲染期间出错:

In template /Library/Python/2.7/site-packages/grappelli_safe/templates/admin/base.html, error at line 19

这是一行:

<script type="text/javascript" src="
      {% static "mezzanine/js/"|add:settings.JQUERY_FILENAME %}
      "></script>

我不知道如何解决这个奇怪的错误。是什么导致了这个以及如何解决它?删除该行时,错误仍然存​​在。

编辑:

完整错误:

Failed lookup for key [settings] in u"[{'False': False, 'None': None, `'True': True}, {}, {}, {'site_header': <django.utils.functional.__proxy__ object at 0x10300f650>, 'site_title': <django.utils.functional.__proxy__ object at 0x10300f610>, 'title': <django.utils.functional.__proxy__ object at 0x10300f690>, 'has_permission': True, 'app_list': [{'app_url': u'/admin/auth/', 'models': [{'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/auth/group/', 'object_name': 'Group', 'name': <django.utils.functional.__proxy__ object at 0x1049e7b50>, 'add_url': u'/admin/auth/group/add/'}, {'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/auth/user/', 'object_name': 'User', 'name': <django.utils.functional.__proxy__ object at 0x1049e73d0>, 'add_url': u'/admin/auth/user/add/'}], 'has_module_perms': True, 'name': <django.utils.functional.__proxy__ object at 0x103019310>, 'app_label': 'auth'}, {'app_url': u'/admin/blog/', 'models': [{'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/blog/blogcategory/', 'object_name': 'BlogCategory', 'name': <django.utils.functional.__proxy__ object at 0x1049e7610>, 'add_url': u'/admin/blog/blogcategory/add/'}, {'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/blog/blogpost/', 'object_name': 'BlogPost', 'name': <django.utils.functional.__proxy__ object at 0x1049e7050>, 'add_url': u'/admin/blog/blogpost/add/'}], 'has_module_perms': True, 'name': u'Blog', 'app_label': u'blog'}, {'app_url': u'/admin/conf/', 'models': [{'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/conf/setting/', 'object_name': 'Setting', 'name': <django.utils.functional.__proxy__ object at 0x1049e7790>, 'add_url': u'/admin/conf/setting/add/'}], 'has_module_perms': True, 'name': u'Conf', 'app_label': u'conf'}, {'app_url': u'/admin/forms/', 'models': [{'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/forms/form/', 'object_name': 'Form', 'name': <django.utils.functional.__proxy__ object at 0x1049e7950>, 'add_url': u'/admin/forms/form/add/'}], 'has_module_perms': True, 'name': u'Forms', 'app_label': u'forms'}, {'app_url': u'/admin/galleries/', 'models': [{'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/galleries/gallery/', 'object_name': 'Gallery', 'name': <django.utils.functional.__proxy__ object at 0x1049e7290>, 'add_url': u'/admin/galleries/gallery/add/'}], 'has_module_perms': True, 'name': u'Galleries', 'app_label': u'galleries'}, {'app_url': u'/admin/generic/', 'models': [{'perms': {'add': False, 'change': True, 'delete': True}, 'admin_url': u'/admin/generic/threadedcomment/', 'object_name': 'ThreadedComment', 'name': <django.utils.functional.__proxy__ object at 0x1049e76d0>}], 'has_module_perms': True, 'name': u'Generic', 'app_label': u'generic'}, {'app_url': u'/admin/pages/', 'models': [{'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/pages/link/', 'object_name': 'Link', 'name': <django.utils.functional.__proxy__ object at 0x1049e70d0>, 'add_url': u'/admin/pages/link/add/'}, {'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/pages/page/', 'object_name': 'Page', 'name': <django.utils.functional.__proxy__ object at 0x1049e7190>, 'add_url': u'/admin/pages/page/add/'}, {'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/pages/richtextpage/', 'object_name': 'RichTextPage', 'name': <django.utils.functional.__proxy__ object at 0x1049e75d0>, 'add_url': u'/admin/pages/richtextpage/add/'}], 'has_module_perms': True, 'name': u'Pages', 'app_label': u'pages'}, {'app_url': u'/admin/redirects/', 'models': [{'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/redirects/redirect/', 'object_name': 'Redirect', 'name': <django.utils.functional.__proxy__ object at 0x1049e71d0>, 'add_url': u'/admin/redirects/redirect/add/'}], 'has_module_perms': True, 'name': <django.utils.functional.__proxy__ object at 0x103019910>, 'app_label': 'redirects'}, {'app_url': u'/admin/sites/', 'models': [{'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url': u'/admin/sites/site/', 'object_name': 'Site', 'name': <django.utils.functional.__proxy__ object at 0x1049e7690>, 'add_url': u'/admin/sites/site/add/'}], 'has_module_perms': True, 'name': <django.utils.functional.__proxy__ object at 0x103019ed0>, 'app_label': 'sites'}], 'site_url': '/'}]"`

现在设置一个视图但我收到错误:

Failed lookup for key [jquery_filename] in u"[{'False': False,'None': None, 'True': True}, {u'params': {}}, {}, {}]"

我的views.py:

from django.conf import settings
from django.shortcuts import render_to_response

def home(request, template='templates/base.html'):
    context = {'jquery_filename': settings.JQUERY_FILENAME}
    return render_to_response(template, context)

base.html文件:

<script src="{% static "mezzanine/js/"|add:jquery_filename %}"></script>

0 个答案:

没有答案