It seems like in 1.6 template code like this:
{% if error %}
...
{% endif %}
Was OK. But in 1.9 if error is not defined it throws an exception. So
in 1.9 what is the proper way to check to see if a variable is defined
or not?
On Tue, Jun 28, 2016 at 4:03 PM, Larry Martell <
larry.martell@gmail.com> wrote:
> I had a 1.6 app and I updated to 1.9. Now when I try to login it fails
> and I see this in the logs. This works in 1.6. Any ideas what the
> issue is?
>
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
> resolving variable 'STATIC_URL' in template 'registration/login.html'.
> Traceback (most recent call last):
> File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
> line 901, in _resolve_lookup
> (bit, current)) # missing attribute
> VariableDoesNotExist: Failed lookup for key [STATIC_URL] in
> u"[{'False': False, 'None': None, 'True': True}, {u'csrf_token':
> <SimpleLazyObject: <function _get_val at 0x7f0e9b8886e0>>,
> 'PYTHON_VERSION': '2.7.9 (default, Mar 1 2015, 13:01:26) ', 'perms':
> <django.contrib.auth.context_processors.PermWrapper object at
> 0x7f0e9ae23290>, u'request': <WSGIRequest: GET '/'>, 'ELUCID_VERSION':
> 'unknown', 'messages':
> <django.contrib.messages.storage.fallback.FallbackStorage object at
> 0x7f0e9ae23310>, 'is_elucid': True, 'my_reports': {},
> 'ELUCID_HOSTNAME': '0d226ac61524', 'user': <SimpleLazyObject: <User:
> admin>>, 'ELUCID_SERVER_NAME': 'localhost', 'NAVSTRUCT': [],
> 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'WARNING': 30,
> 'SUCCESS': 25, 'ERROR': 40}, 'base_template': 'base_elucid.html',
> 'DJANGO_VERSION': '1.9'}, {}, {'site_name': '
bekku.bbmsc.com:8004',
> 'site': <django.contrib.sites.requests.RequestSite object at
> 0x7f0e9ae23750>, 'form': <AuthenticationForm bound=False,
> valid=Unknown, fields=(username;password)>, 'next': ''}]"
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
> resolving variable 'msie6_user_agent' in template
> 'registration/login.html'.
> Traceback (most recent call last):
> File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
> line 901, in _resolve_lookup
> (bit, current)) # missing attribute
> VariableDoesNotExist: Failed lookup for key [msie6_user_agent] in
> u"[{'False': False, 'None': None, 'True': True}, {u'csrf_token':
> <SimpleLazyObject: <function _get_val at 0x7f0e9b8886e0>>,
> 'PYTHON_VERSION': '2.7.9 (default, Mar 1 2015, 13:01:26) ', 'perms':
> <django.contrib.auth.context_processors.PermWrapper object at
> 0x7f0e9ae23290>, u'request': <WSGIRequest: GET '/'>, 'ELUCID_VERSION':
> 'unknown', 'messages':
> <django.contrib.messages.storage.fallback.FallbackStorage object at
> 0x7f0e9ae23310>, 'is_elucid': True, 'my_reports': {},
> 'ELUCID_HOSTNAME': '0d226ac61524', 'user': <SimpleLazyObject: <User:
> admin>>, 'ELUCID_SERVER_NAME': 'localhost', 'NAVSTRUCT': [],
> 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'WARNING': 30,
> 'SUCCESS': 25, 'ERROR': 40}, 'base_template': 'base_elucid.html',
> 'DJANGO_VERSION': '1.9'}, {}, {'site_name': '
bekku.bbmsc.com:8004',
> 'site': <django.contrib.sites.requests.RequestSite object at
> 0x7f0e9ae23750>, 'form': <AuthenticationForm bound=False,
> valid=Unknown, fields=(username;password)>, 'next': ''}]"
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
> resolving variable 'STATIC_URL' in template 'registration/login.html'.
> Traceback (most recent call last):
> File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
> line 901, in _resolve_lookup
> (bit, current)) # missing attribute
> VariableDoesNotExist: Failed lookup for key [STATIC_URL] in
> u"[{'False': False, 'None': None, 'True': True}, {u'csrf_token':
> <SimpleLazyObject: <function _get_val at 0x7f0e9b8886e0>>,
> 'PYTHON_VERSION': '2.7.9 (default, Mar 1 2015, 13:01:26) ', 'perms':
> <django.contrib.auth.context_processors.PermWrapper object at
> 0x7f0e9ae23290>, u'request': <WSGIRequest: GET '/'>, 'ELUCID_VERSION':
> 'unknown', 'messages':
> <django.contrib.messages.storage.fallback.FallbackStorage object at
> 0x7f0e9ae23310>, 'is_elucid': True, 'my_reports': {},
> 'ELUCID_HOSTNAME': '0d226ac61524', 'user': <SimpleLazyObject: <User:
> admin>>, 'ELUCID_SERVER_NAME': 'localhost', 'NAVSTRUCT': [],
> 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'WARNING': 30,
> 'SUCCESS': 25, 'ERROR': 40}, 'base_template': 'base_elucid.html',
> 'DJANGO_VERSION': '1.9'}, {}, {'site_name': '
bekku.bbmsc.com:8004',
> 'site': <django.contrib.sites.requests.RequestSite object at
> 0x7f0e9ae23750>, 'form': <AuthenticationForm bound=False,
> valid=Unknown, fields=(username;password)>, 'next': ''}]"
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
> resolving variable 'User' in template 'registration/login.html'.
> Traceback (most recent call last):
> File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
> line 901, in _resolve_lookup
> (bit, current)) # missing attribute
> VariableDoesNotExist: Failed lookup for key [User] in u"<WSGIRequest: GET '/'>"
> [28/Jun/2016 17:43:51] WARNING [django.request:182] Not Found:
> /scripts/chosen/chosen.css
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
> resolving variable 'name' in template 'unknown'.
> Traceback (most recent call last):
> File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
> line 901, in _resolve_lookup
> (bit, current)) # missing attribute
> VariableDoesNotExist: Failed lookup for key [name] in
> u'<RegexURLResolver <RegexURLPattern list> (admin:admin) ^admin/>'
> [28/Jun/2016 17:43:51] WARNING [django.request:182] Not Found:
> /scripts/chosen/chosen.jquery.min.js
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
> resolving variable 'name' in template 'unknown'.
> Traceback (most recent call last):
> File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
> line 901, in _resolve_lookup
> (bit, current)) # missing attribute
> VariableDoesNotExist: Failed lookup for key [name] in
> u'<RegexURLResolver <RegexURLPattern list> (admin:admin) ^admin/>'
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
django-users+unsubscribe@googlegroups.com.
To post to this group, send email to
django-users@googlegroups.com.
Visit this group at
https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CACwCsY4toCoB6NDETS-Y0p3AOAvWL%2BkYsVTyMV-gH-PWjL7wNQ%40mail.gmail.com.
For more options, visit
https://groups.google.com/d/optout.