繁体   English   中英

django 1.10在模板'admin / login.html'中解析变量'is_popup'时出现异常

[英]django 1.10 Exception while resolving variable 'is_popup' in template 'admin/login.html'

我使用python3.5和django1.10.0创建了一个新的django项目,每当我想访问localhost:8000/admin时,我一直在管理员中收到错误localhost:8000/admin ,他是错误的:

[DEBUG]- Exception while resolving variable 'is_popup' in template 'admin/login.html'.
Traceback (most recent call last):
  File "C:\Python\Python35\lib\site-packages\django\template\base.py", line 885, in _resolve_lookup
    current = current[bit]
  File "C:\Python\Python35\lib\site-packages\django\template\context.py", line 75, in __getitem__
    raise KeyError(key)
KeyError: 'is_popup'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python\Python35\lib\site-packages\django\template\base.py", line 891, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(type(current), bit):
AttributeError: type object 'RequestContext' has no attribute 'is_popup'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python\Python35\lib\site-packages\django\template\base.py", line 900, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'is_popup'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python\Python35\lib\site-packages\django\template\base.py", line 907, in _resolve_lookup
    (bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [is_popup] in "[{'True': True, 'None': None, 'False': False}, {'perms': <django.contrib.auth.context_processors.PermWrapper object at 0x04A2D1D0>, 'DEFAULT_MESSAGE_LEVELS': {'WARNING': 30, 'SUCCESS': 25, 'ERROR': 40, 'INFO': 20, 'DEBUG': 10}, 'user': <SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x04A0A590>>, 'messages': <django.contrib.messages.storage.fallback.FallbackStorage object at 0x04A0A490>, 'request': <WSGIRequest: GET '/admin/login/?next=/admin/'>, 'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val at 0x04581C90>>}, {}, {'has_permission': False, 'username': '', 'site_title': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x03CF82B0>, 'next': '/admin/', 'site': <django.contrib.sites.requests.RequestSite object at 0x04A0A6D0>, 'app_path': '/admin/login/?next=/admin/', 'site_url': '/', 'site_name': '127.0.0.1:8000', 'available_apps': [], 'LANGUAGE_BIDI': False, 'LANGUAGE_CODE': 'en-us', 'form': <AdminAuthenticationForm bound=False, valid=Unknown, fields=(username;password)>, 'site_header': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x03CF8310>, 'title': 'Log in'}]"
2016-10-16 09:31:59,199 [Thread-7:11460] [django.template:929] [base:_resolve_lookup] [DEBUG]- Exception while resolving variable 'is_popup' in template 'admin/login.html'.
Traceback (most recent call last):
  File "C:\Python\Python35\lib\site-packages\django\template\base.py", line 885, in _resolve_lookup
    current = current[bit]
  File "C:\Python\Python35\lib\site-packages\django\template\context.py", line 75, in __getitem__
    raise KeyError(key)
KeyError: 'is_popup'

任何人都可以帮助我,非常感谢!

我遇到了这个错误,结果是因为我在我的主设置文件中放了SESSION_COOKIE_SECURE = True而忘记在我的开发设置中放置SESSION_COOKIE_SECURE = False (就像使用manage.py runserver时的OP一样,所以安全的cookie不可能)。

暂无
暂无

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

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