# Cannot login to django admin due to Exception while resolving variable 'subtitle' in template 'admin/login.html'.

**URL:** <https://forum.djangoproject.com/t/cannot-login-to-django-admin-due-to-exception-while-resolving-variable-subtitle-in-template-admin-login-html/8251>\
**Category:** Using Django\
**Created:** [June 7, 2021, 5:54pm UTC](https://forum.djangoproject.com/t/cannot-login-to-django-admin-due-to-exception-while-resolving-variable-subtitle-in-template-admin-login-html/8251 "2021-06-07T17:54:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ste.j](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ste.j/32/4773_2.png) [@ste.j](https://forum.djangoproject.com/u/ste.j)\
**Post date:** [June 7, 2021, 5:54pm UTC](https://forum.djangoproject.com/t/cannot-login-to-django-admin-due-to-exception-while-resolving-variable-subtitle-in-template-admin-login-html/8251/1 "2021-06-07T17:54:17Z")

</div>

Hi after upgrading from django 3.1.11 to 3.2.4, I cannot seem to be able to login to django admin.  
Whenever I type in username/password to login, I get `Exception while resolving variable 'subtitle' in template 'admin/login.html'.`

It is the same problem as described in [this ticket](https://code.djangoproject.com/ticket/32681), but it seems to have been merged & released, but it keeps coming back. Any ideas?

Thanks.

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [June 7, 2021, 6:12pm UTC](https://forum.djangoproject.com/t/cannot-login-to-django-admin-due-to-exception-while-resolving-variable-subtitle-in-template-admin-login-html/8251/2 "2021-06-07T18:12:36Z")

</div>

Hi - the issue in the ticket as fixed in the commit covered some views and templates inside Django itself. Perhaps your admin is having a problem in a customized view? Can you share the full stack trace? (always a good idea!)

---

<div class="post-metadata">

**Author:** ![ste.j](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ste.j/32/4773_2.png) [@ste.j](https://forum.djangoproject.com/u/ste.j)\
**Post date:** [June 8, 2021, 1:04am UTC](https://forum.djangoproject.com/t/cannot-login-to-django-admin-due-to-exception-while-resolving-variable-subtitle-in-template-admin-login-html/8251/3 "2021-06-08T01:04:10Z")

</div>

@adamchainz  
Hi Adam, thanks for the reply. Here’s the full stack trace.  
Hope this helps.

```auto
Hi Adam, thanks for the reply. Here's the full stack trace. 
Hope this helps.
"""
1623086254886,"2021-06-07 17:17:34,885 django.template DEBUG Exception while resolving variable 'subtitle' in template 'admin/login.html'."
1623086254886,Traceback (most recent call last):
1623086254886," File ""/usr/local/lib/python3.9/site-packages/django/template/base.py"", line 829, in _resolve_lookup"
1623086254886, current = current[bit]
1623086254886," File ""/usr/local/lib/python3.9/site-packages/django/template/context.py"", line 83, in __getitem__"
1623086254886, raise KeyError(key)
1623086254886,KeyError: 'subtitle'
1623086254886,"During handling of the above exception, another exception occurred:"
1623086254886,Traceback (most recent call last):
1623086254886," File ""/usr/local/lib/python3.9/site-packages/django/template/base.py"", line 835, in _resolve_lookup"
1623086254886," if isinstance(current, BaseContext) and getattr(type(current), bit):"
1623086254886,AttributeError: type object 'RequestContext' has no
   attribute 'subtitle'
1623086254886,"During handling of the above exception, another exception occurred:"
1623086254886,Traceback (most recent call last):
1623086254886," File ""/usr/local/lib/python3.9/site-packages/django/template/base.py"", line 843, in _resolve_lookup"
1623086254886, current = current[int(bit)]
1623086254886,ValueError: invalid literal for int() with base 10: 'subtitle'
1623086254886,"During handling of the above exception, another exception occurred:"
1623086254886,Traceback (most recent call last):
1623086254886," File ""/usr/local/lib/python3.9/site-packages/django/template/base.py"", line 848, in _resolve_lookup"
1623086254886," raise VariableDoesNotExist(""Failed lookup for key """
1623086254886,"django.template.base.VariableDoesNotExist: Failed lookup for key [subtitle] in [{'True': True, 'False': False, 'None': None}, {'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val
   at 0x7f6e9978dee0>>, 'request': <WSGIRequest: GET '/admin/login/?next=/admin/'>, 'user': <SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object
   at 0x7f6e99877220>>, 'perms': <django.contrib.auth.context_processors.PermWrapper object
   at 0x7f6e99686730>, 'LANGUAGES': [('af', 'Afrikaans').0x7f6e99686730>, 'LANGUAGES': [('af', 'Afrikaans'), ('ar', 'Arabic'), ('ar-dz', 'Algerian Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('hy', 'Armenian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('ig', 'Igbo'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('ky', 'Kyrgyz'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('tg', 'Tajik'), ('th', 'Thai'), ('tk', 'Turkmen'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('uz', 'Uzbek'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')], 'LANGUAGE_CODE': 'en', 'LANGUAGE_BIDI': False, 'MEDIA_URL': 'https://mint-assets.glamtutor.com/media/', 'STATIC_URL': 'https://mint-assets.glamtutor.com/static/', 'TIME_ZONE': 'UTC', 'messages': <django.contrib.messages.storage.fallback.FallbackStorage object
   at 0x7f6e99e38070>, 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'SUCCESS': 25, 'WARNING': 30, 'ERROR': 40}, 'DEBUG': False}, {}, {'form': <AdminAuthenticationForm bound=False, valid=Unknown, fields=.0x7f6e99e38070>, 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'SUCCESS': 25, 'WARNING': 30, 'ERROR': 40}, 'DEBUG': False}, {}, {'form': <AdminAuthenticationForm bound=False, valid=Unknown, fields=(username;password undefined)>, 'view': <django.contrib.auth.views.LoginView object
   at 0x7f6e99877130>, 'site_title': 'Django site admin', 'site_header': 'Django administration', 'site_url': '/', 'has_permission': False, 'available_apps': [], 'is_popup': False, 'is_nav_sidebar_enabled': True, 'title': 'Log in', 'app_path': '/admin/login/?next=/admin/', 'username': '', 'next': '/admin/', 'site': <Site: mspw.io>, 'site_name': 'mint-backend', 'LANGUAGE_CODE': 'en', 'LANGUAGE_BIDI': False}, {'block': <Block Node: title. Contents: [<IfNode>, <Variable Node: title>, <TextNode: ' | '>, <Variable Node: site_title|default:_('Django site)>]>}]"
1623086254889,"2021-06-07 17:17:34,889 django.template DEBUG Exception while resolving variable 'subtitle' in template 'admin/login.html'."
"""

Formatted by https://st.elmah.io

```

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [June 8, 2021, 11:30am UTC](https://forum.djangoproject.com/t/cannot-login-to-django-admin-due-to-exception-while-resolving-variable-subtitle-in-template-admin-login-html/8251/4 "2021-06-08T11:30:55Z")

</div>

You didn’t answer - have you customized your view? Or your `login.html`, `AdminSite`, etc.? I think opening a ticket with all the details you can give is best at this point. Ideally you could make a small project that reproduces the bug.

---

<div class="post-metadata">

**Author:** ![ste.j](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ste.j/32/4773_2.png) [@ste.j](https://forum.djangoproject.com/u/ste.j)\
**Post date:** [June 11, 2021, 3:15pm UTC](https://forum.djangoproject.com/t/cannot-login-to-django-admin-due-to-exception-while-resolving-variable-subtitle-in-template-admin-login-html/8251/5 "2021-06-11T15:15:03Z")

</div>

No I haven’t customized any one my view although I suspect using django-allauth might be an issue (I looked up the issues in their repo, but couldn’t find any related ones - but it’s the only library that I use that might be related to authentication)

---

<div class="post-metadata">

**Author:** ![fromhans](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/fromhans/32/5720_2.png) [@fromhans](https://forum.djangoproject.com/u/fromhans)\
**Post date:** [September 3, 2021, 5:48am UTC](https://forum.djangoproject.com/t/cannot-login-to-django-admin-due-to-exception-while-resolving-variable-subtitle-in-template-admin-login-html/8251/6 "2021-09-03T05:48:31Z")

</div>

@ste.j  
Have you fixed this issues? I have same problems… any tips for solving this would be appreciated
