Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

django

I create a new django project with python3.5 and django1.10.0,I keep getting an error in the admin whenever I want access localhost:8000/admin, He`re's the error:

[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'

Anyone can help me,thanks very much!

like image 956
fangjianbin Avatar asked Oct 16 '16 01:10

fangjianbin


1 Answers

I came across this error, and it turned out to be because I had put SESSION_COOKIE_SECURE = True in my main settings file and forgotten to put SESSION_COOKIE_SECURE = False in my dev settings (as with the OP this was while using manage.py runserver, so secure cookies were not possible).

like image 134
dhobbs Avatar answered Oct 20 '22 23:10

dhobbs