Reputation: 351
I use wagtail 6.3.1 for a bilingual application. Now I established logging despite I had no problem with my pages generated by Wagtail. Still the pages look good, context variables are populated correctly but I get over 1000 lines of log. These log messages complain missing variables. The missing variables the log refers to even not included in any of my templates or "includes", blocks or inclusive tags. Here is a small subset of the log:
DEBUG 2024-12-09 20:08:10,251 base 24273 136577802045120 Exception while resolving variable 'settings' in template 'home/home_page.html'.
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 883, in _resolve_lookup
current = current[bit]
~~~~~~~^^^^^
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/context.py", line 85, in __getitem__
raise KeyError(key)
KeyError: 'settings'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 889, in _resolve_lookup
if isinstance(current, BaseContext) and getattr(
^^^^^^^^
AttributeError: type object 'RequestContext' has no attribute 'settings'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 899, in _resolve_lookup
current = current[int(bit)]
^^^^^^^^
ValueError: invalid literal for int() with base 10: 'settings'
...
DEBUG 2024-12-09 20:08:10,264 base 24273 136577802045120 Exception while resolving variable 'in_preview_panel' in template 'home/home_page.html'.
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 883, in _resolve_lookup
current = current[bit]
~~~~~~~^^^^^
TypeError: 'WSGIRequest' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 893, in _resolve_lookup
current = getattr(current, bit)
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'WSGIRequest' object has no attribute 'in_preview_panel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 899, in _resolve_lookup
current = current[int(bit)]
^^^^^^^^
ValueError: invalid literal for int() with base 10: 'in_preview_panel'
...
DEBUG 2024-12-09 20:08:10,270 base 24273 136577802045120 Exception while resolving variable 'target_blank' in template 'home/home_page.html'.
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 883, in _resolve_lookup
current = current[bit]
~~~~~~~^^^^^
TypeError: 'StreamChild' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 893, in _resolve_lookup
current = getattr(current, bit)
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'StreamChild' object has no attribute 'target_blank'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 899, in _resolve_lookup
current = current[int(bit)]
^^^^^^^^
ValueError: invalid literal for int() with base 10: 'target_blank'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 906, in _resolve_lookup
raise VariableDoesNotExist(
django.template.base.VariableDoesNotExist: Failed lookup for key [target_blank] in <block link: StructValue({'title': 'Business Insights', 'url': '', 'page_url': <Page: Business Insights>, 'target_blank': False, 'custom_css': '', 'id': ''})>
DEBUG 2024-12-09 20:08:10,272 base 24273 136577802045120 Exception while resolving variable 'target_blank' in template 'home/home_page.html'.
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 883, in _resolve_lookup
current = current[bit]
~~~~~~~^^^^^
TypeError: 'StreamChild' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 893, in _resolve_lookup
current = getattr(current, bit)
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'StreamChild' object has no attribute 'target_blank'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 899, in _resolve_lookup
current = current[int(bit)]
^^^^^^^^
ValueError: invalid literal for int() with base 10: 'target_blank'
From the time I experience this error, I can not log in to wagtail admin. I wrote a dummy custom authentication middleware just to catch what is in the request and what is the content of the POST. Here is what I got:
Login attempt detected
POST data: <QueryDict: {}>
Session: dict_items([])
Response status: 200
Response headers: {'Content-Type': 'text/html; charset=utf-8', 'Expires': 'Mon, 09 Dec 2024 19:15:42 GMT', 'Cache-Control': 'max-age=0, no-cache, no-store, must-revalidate, private', 'Vary': 'Cookie', 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'same-origin', 'Cross-Origin-Opener-Policy': 'same-origin', 'X-Frame-Options': 'DENY'}
Sometimes my log shows different kind of erros:
DEBUG 2024-12-09 20:15:30,820 base 25137 138214654346944 Exception while resolving variable 'name' in template 'unknown'.
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/core/handlers/base.py", line 181, in _get_response
callback, callback_args, callback_kwargs = self.resolve_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/core/handlers/base.py", line 313, in resolve_request
resolver_match = resolver.resolve(request.path_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/urls/resolvers.py", line 705, in resolve
raise Resolver404({"tried": tried, "path": new_path})
django.urls.exceptions.Resolver404: {'tried': [[<URLPattern 'sitemap.xml'>], [<URLResolver <URLPattern list> (admin:admin) 'django-admin/'>], [<URLResolver <module 'ai_blog2.wagtailadmin_urls' from '/home/roland/Documents/developments/ai_blog2/ai_blog2/wagtailadmin_urls.py'> (None:None) 'admin/'>], [<URLResolver <module 'wagtail.documents.urls' from '/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/wagtail/documents/urls.py'> (None:None) 'documents/'>], [<URLPattern 'log-event/' [name='log_event']>], [<URLPattern 'api/search/results/' [name='search_results']>], [<URLPattern 'api/search/tags/' [name='tag_suggestions']>], [<URLResolver <URLPattern list> (None:None) 'en/'>], [<URLPattern '^static/(?P<path>.*)$'>], [<URLPattern '^media/(?P<path>.*)$'>]], 'path': ''}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 883, in _resolve_lookup
current = current[bit]
~~~~~~~^^^^^
TypeError: 'URLResolver' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 893, in _resolve_lookup
current = getattr(current, bit)
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'URLResolver' object has no attribute 'name'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roland/.pyenv/versions/3.12.7/envs/ai_blog2/lib/python3.12/site-packages/django/template/base.py", line 899, in _resolve_lookup
current = current[int(bit)]
^^^^^^^^
ValueError: invalid literal for int() with base 10: 'name'
I do not use any custom middlewares just temporarily to catch what is going on with the admin.
Any help is appreciated.
Upvotes: 0
Views: 20