sehmaschine / django-grappelli

A jazzy skin for the Django Admin-Interface (official repository).
http://www.grappelliproject.com
Other
3.77k stars 657 forks source link

Errors logged #1058

Open jonasN5 opened 1 month ago

jonasN5 commented 1 month ago

When accessing the admin page, we currently have a bunch of errors logged:

2024-10-23 16:15:20,746 [DEBUG] django.template: Exception while resolving variable 'debug' in template 'admin/index.html'.
Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 883, in _resolve_lookup
    current = current[bit]
              ~~~~~~~^^^^^
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/context.py", line 85, in __getitem__
    raise KeyError(key)
KeyError: 'debug'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 889, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(
                                            ^^^^^^^^
AttributeError: type object 'RequestContext' has no attribute 'debug'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 899, in _resolve_lookup
    current = current[int(bit)]
                      ^^^^^^^^
ValueError: invalid literal for int() with base 10: 'debug'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 906, in _resolve_lookup
    raise VariableDoesNotExist(
django.template.base.VariableDoesNotExist: Failed lookup for key [debug] in [{'True': True, 'False': False, 'None': None}, {'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val at 0x1085ab1a0>>, 'request': <WSGIRequest: GET '/admin/'>, 'user': <SimpleLazyObject: <User: myUser>>, 'perms': PermWrapper(<SimpleLazyObject: <User: myUser>>), 'messages': <FallbackStorage: request=<WSGIRequest: GET '/admin/'>>, 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'SUCCESS': 25, 'WARNING': 30, 'ERROR': 40}}, {}, {'site_title': 'Django site admin', 'site_header': 'Django administration', 'site_url': '/', 'has_permission': True, 'available_apps': [{'name': 'Authentication and Authorization', 'app_label': 'auth', 'app_url': '/admin/auth/', 'has_module_perms': True, 'models': [{'model': <class 'django.contrib.auth.models.Group'>, 'name': 'Groups', 'object_name': 'Group', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/group/', 'add_url': '/admin/auth/group/add/', 'view_only': False}, {'model': <class 'django.contrib.auth.models.User'>, 'name': 'Users', 'object_name': 'User', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/user/', 'add_url': '/admin/auth/user/add/', 'view_only': False}]}], 'is_popup': False, 'is_nav_sidebar_enabled': True, 'log_entries': <QuerySet []>, 'title': 'Site administration', 'subtitle': None, 'app_list': [{'name': 'Authentication and Authorization', 'app_label': 'auth', 'app_url': '/admin/auth/', 'has_module_perms': True, 'models': [{'model': <class 'django.contrib.auth.models.Group'>, 'name': 'Groups', 'object_name': 'Group', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/group/', 'add_url': '/admin/auth/group/add/', 'view_only': False}, {'model': <class 'django.contrib.auth.models.User'>, 'name': 'Users', 'object_name': 'User', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/user/', 'add_url': '/admin/auth/user/add/', 'view_only': False}]}], 'LANGUAGE_CODE': 'en-us', 'LANGUAGE_BIDI': False}, {'block': <Block Node: javascripts. Contents: [<TextNode: '\n    '>, <Variable Node: block.super>, <TextNode: '\n'>]>}, {'block': <Block Node: javascripts. Contents: [<TextNode: '\n        <script type="te'>, <django.template.defaulttags.FilterNode object at 0x108656a90>, <TextNode: '";</script>\n        <scri'>, <django.template.defaulttags.FilterNode object at 0x108529f90>, <TextNode: '";</script>\n        <scri'>, <URLNode view_name=''admin:index'' args=[] kwargs={} as=None>, <TextNode: '",\n                MODEL_'>, <IfNode>, <TextNode: ',\n                DATE_FO'>, <django.template.library.SimpleNode object at 0x10866f350>, <TextNode: '",\n                TIME_F'>, <django.template.library.SimpleNode object at 0x10866f450>, <TextNode: '",\n                DATETI'>, <django.template.library.SimpleNode object at 0x10866f550>, <TextNode: '";\n        </script>\n    '>, StaticNode(varname=None, path=<FilterExpression '"grappelli/jquery/jquery.min.js"'>), <TextNode: '" type="text/javascript">'>, StaticNode(varname=None, path=<FilterExpression '"grappelli/jquery/jquery-migrate-3.0.1.min.js"'>), <TextNode: '" type="text/javascript">'>, StaticNode(varname=None, path=<FilterExpression '"grappelli/jquery/ui/jquery-ui.min.js"'>), <TextNode: '" type="text/javascript">'>, <IfNode>, <TextNode: '\n        <script type="te'>]>}]
2024-10-23 16:15:20,749 [DEBUG] django.db.backends: (0.000) SELECT "django_admin_log"."id", "django_admin_log"."action_time", "django_admin_log"."user_id", "django_admin_log"."content_type_id", "django_admin_log"."object_id", "django_admin_log"."object_repr", "django_admin_log"."action_flag", "django_admin_log"."change_message", "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined", "django_content_type"."id", "django_content_type"."app_label", "django_content_type"."model" FROM "django_admin_log" INNER JOIN "auth_user" ON ("django_admin_log"."user_id" = "auth_user"."id") LEFT OUTER JOIN "django_content_type" ON ("django_admin_log"."content_type_id" = "django_content_type"."id") ORDER BY "django_admin_log"."action_time" DESC LIMIT 21; args=(); alias=default
2024-10-23 16:15:20,749 [DEBUG] django.template: Exception while resolving variable 'grappelli_admin_title' in template 'admin/index.html'.
Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 883, in _resolve_lookup
    current = current[bit]
              ~~~~~~~^^^^^
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/context.py", line 85, in __getitem__
    raise KeyError(key)
KeyError: 'grappelli_admin_title'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 889, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(
                                            ^^^^^^^^
AttributeError: type object 'RequestContext' has no attribute 'grappelli_admin_title'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 899, in _resolve_lookup
    current = current[int(bit)]
                      ^^^^^^^^
ValueError: invalid literal for int() with base 10: 'grappelli_admin_title'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 906, in _resolve_lookup
    raise VariableDoesNotExist(
django.template.base.VariableDoesNotExist: Failed lookup for key [grappelli_admin_title] in [{'True': True, 'False': False, 'None': None}, {'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val at 0x1085ab1a0>>, 'request': <WSGIRequest: GET '/admin/'>, 'user': <SimpleLazyObject: <User: myUser>>, 'perms': PermWrapper(<SimpleLazyObject: <User: myUser>>), 'messages': <FallbackStorage: request=<WSGIRequest: GET '/admin/'>>, 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'SUCCESS': 25, 'WARNING': 30, 'ERROR': 40}}, {}, {'site_title': 'Django site admin', 'site_header': 'Django administration', 'site_url': '/', 'has_permission': True, 'available_apps': [{'name': 'Authentication and Authorization', 'app_label': 'auth', 'app_url': '/admin/auth/', 'has_module_perms': True, 'models': [{'model': <class 'django.contrib.auth.models.Group'>, 'name': 'Groups', 'object_name': 'Group', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/group/', 'add_url': '/admin/auth/group/add/', 'view_only': False}, {'model': <class 'django.contrib.auth.models.User'>, 'name': 'Users', 'object_name': 'User', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/user/', 'add_url': '/admin/auth/user/add/', 'view_only': False}]}], 'is_popup': False, 'is_nav_sidebar_enabled': True, 'log_entries': <QuerySet []>, 'title': 'Site administration', 'subtitle': None, 'app_list': [{'name': 'Authentication and Authorization', 'app_label': 'auth', 'app_url': '/admin/auth/', 'has_module_perms': True, 'models': [{'model': <class 'django.contrib.auth.models.Group'>, 'name': 'Groups', 'object_name': 'Group', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/group/', 'add_url': '/admin/auth/group/add/', 'view_only': False}, {'model': <class 'django.contrib.auth.models.User'>, 'name': 'Users', 'object_name': 'User', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/user/', 'add_url': '/admin/auth/user/add/', 'view_only': False}]}], 'LANGUAGE_CODE': 'en-us', 'LANGUAGE_BIDI': False}, {'block': <Block Node: header. Contents: [<TextNode: '\n            <!-- HEADER '>, <Block Node: header-class. Contents: []>, <TextNode: '">\n                '>, <IfNode>, <TextNode: '\n            </header>\n  '>]>}, {'block': <Block Node: navigation. Contents: [<TextNode: '\n                        '>, <Block Node: branding. Contents: []>, <TextNode: '\n                        '>, <Block Node: admin_title. Contents: [<TextNode: '\n                        '>, <django.templatetags.i18n.TranslateNode object at 0x10867a110>, <TextNode: '\n                        '>, <IfNode>, <TextNode: '\n                        '>]>, <TextNode: '\n                        '>, <Block Node: user-tools. Contents: [<TextNode: '\n                        '>, <IfNode>, <TextNode: '\n                        '>]>, <TextNode: '\n                        '>, <Block Node: nav-global. Contents: []>, <TextNode: '\n                        '>]>}, {'block': <Block Node: admin_title. Contents: [<TextNode: '\n                        '>, <django.templatetags.i18n.TranslateNode object at 0x10867a110>, <TextNode: '\n                        '>, <IfNode>, <TextNode: '\n                        '>]>, 'vanilla_site_header': 'Django administration'}]
2024-10-23 16:15:20,750 [DEBUG] django.template: Exception while resolving variable 'original_user' in template 'admin/index.html'.
Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 883, in _resolve_lookup
    current = current[bit]
              ~~~~~~~^^^^^
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 55, in __getitem__
    return self._session[key]
           ~~~~~~~~~~~~~^^^^^
KeyError: 'original_user'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 893, in _resolve_lookup
    current = getattr(current, bit)
              ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionStore' object has no attribute 'original_user'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 899, in _resolve_lookup
    current = current[int(bit)]
                      ^^^^^^^^
ValueError: invalid literal for int() with base 10: 'original_user'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 906, in _resolve_lookup
    raise VariableDoesNotExist(
django.template.base.VariableDoesNotExist: Failed lookup for key [original_user] in <django.contrib.sessions.backends.db.SessionStore object at 0x1085fbc50>
2024-10-23 16:15:20,751 [DEBUG] django.template: Exception while resolving variable 'original_user' in template 'admin/index.html'.
Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 883, in _resolve_lookup
    current = current[bit]
              ~~~~~~~^^^^^
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 55, in __getitem__
    return self._session[key]
           ~~~~~~~~~~~~~^^^^^
KeyError: 'original_user'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 893, in _resolve_lookup
    current = getattr(current, bit)
              ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionStore' object has no attribute 'original_user'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 899, in _resolve_lookup
    current = current[int(bit)]
                      ^^^^^^^^
ValueError: invalid literal for int() with base 10: 'original_user'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 906, in _resolve_lookup
    raise VariableDoesNotExist(
django.template.base.VariableDoesNotExist: Failed lookup for key [original_user] in <django.contrib.sessions.backends.db.SessionStore object at 0x1085fbc50>
2024-10-23 16:15:20,752 [DEBUG] django.db.backends: (0.000) SELECT "django_admin_log"."id", "django_admin_log"."action_time", "django_admin_log"."user_id", "django_admin_log"."content_type_id", "django_admin_log"."object_id", "django_admin_log"."object_repr", "django_admin_log"."action_flag", "django_admin_log"."change_message", "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined", "django_content_type"."id", "django_content_type"."app_label", "django_content_type"."model" FROM "django_admin_log" INNER JOIN "auth_user" ON ("django_admin_log"."user_id" = "auth_user"."id") LEFT OUTER JOIN "django_content_type" ON ("django_admin_log"."content_type_id" = "django_content_type"."id") ORDER BY "django_admin_log"."action_time" DESC LIMIT 21; args=(); alias=default
2024-10-23 16:15:20,751 [DEBUG] django.template: Exception while resolving variable 'custom_list' in template 'admin/index.html'.
Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 883, in _resolve_lookup
    current = current[bit]
              ~~~~~~~^^^^^
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/context.py", line 85, in __getitem__
    raise KeyError(key)
KeyError: 'custom_list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 889, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(
                                            ^^^^^^^^
AttributeError: type object 'RequestContext' has no attribute 'custom_list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 899, in _resolve_lookup
    current = current[int(bit)]
                      ^^^^^^^^
ValueError: invalid literal for int() with base 10: 'custom_list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myUser/PycharmProjects/djangoProject/.venv/lib/python3.11/site-packages/django/template/base.py", line 906, in _resolve_lookup
    raise VariableDoesNotExist(
django.template.base.VariableDoesNotExist: Failed lookup for key [custom_list] in [{'True': True, 'False': False, 'None': None}, {'csrf_token': <SimpleLazyObject: '0bOxjFFow4GxrXBE33Q556o5tjluIsbsbexnf44Xgg1L2dXfH1ZNw8VPLvrgwWN8'>, 'request': <WSGIRequest: GET '/admin/'>, 'user': <SimpleLazyObject: <User: myUser>>, 'perms': PermWrapper(<SimpleLazyObject: <User: myUser>>), 'messages': <FallbackStorage: request=<WSGIRequest: GET '/admin/'>>, 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'SUCCESS': 25, 'WARNING': 30, 'ERROR': 40}}, {}, {'site_title': 'Django site admin', 'site_header': 'Django administration', 'site_url': '/', 'has_permission': True, 'available_apps': [{'name': 'Authentication and Authorization', 'app_label': 'auth', 'app_url': '/admin/auth/', 'has_module_perms': True, 'models': [{'model': <class 'django.contrib.auth.models.Group'>, 'name': 'Groups', 'object_name': 'Group', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/group/', 'add_url': '/admin/auth/group/add/', 'view_only': False}, {'model': <class 'django.contrib.auth.models.User'>, 'name': 'Users', 'object_name': 'User', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/user/', 'add_url': '/admin/auth/user/add/', 'view_only': False}]}], 'is_popup': False, 'is_nav_sidebar_enabled': True, 'log_entries': <QuerySet []>, 'title': 'Site administration', 'subtitle': None, 'app_list': [{'name': 'Authentication and Authorization', 'app_label': 'auth', 'app_url': '/admin/auth/', 'has_module_perms': True, 'models': [{'model': <class 'django.contrib.auth.models.Group'>, 'name': 'Groups', 'object_name': 'Group', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/group/', 'add_url': '/admin/auth/group/add/', 'view_only': False}, {'model': <class 'django.contrib.auth.models.User'>, 'name': 'Users', 'object_name': 'User', 'perms': {'add': True, 'change': True, 'delete': True, 'view': True}, 'admin_url': '/admin/auth/user/', 'add_url': '/admin/auth/user/add/', 'view_only': False}]}], 'LANGUAGE_CODE': 'en-us', 'LANGUAGE_BIDI': False}, {'block': <Block Node: content. Contents: [<TextNode: '\n    <div class="g-d-c">\n'>, <ForNode: for app in app_list, tail_len: 9>, <TextNode: '\n            '>, <Block Node: custom_views. Contents: [<TextNode: '\n                '>, <IfNode>, <TextNode: '\n            '>]>, <TextNode: '\n        </div>\n        <'>, <django.templatetags.i18n.TranslateNode object at 0x108656790>, <TextNode: '</h2>\n                <di'>, <django.templatetags.i18n.TranslateNode object at 0x108656910>, <TextNode: '</h3>\n                   '>, <GetAdminLog Node>, <TextNode: '\n                    '>, <IfNode>, <TextNode: '\n                </div>\n '>]>}, {'block': <Block Node: custom_views. Contents: [<TextNode: '\n                '>, <IfNode>, <TextNode: '\n            '>]>}]

This currently happens in a completely new project with nothing installed and no code. All I did was install grappelli. Without grappelli, no error is logged.

Settings:

"""
Django settings for djangoProject project.

Generated by 'django-admin startproject' using Django 5.1.2.

For more information on this file, see
https://docs.djangoproject.com/en/5.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.1/ref/settings/
"""

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-4%*&)$xx(f%f2(e89&tl+d-_lb-o%x4tk*e-!#9qgccf(0z@)('

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = [
    'grappelli',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'djangoProject.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates']
        ,
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'djangoProject.wsgi.application'

# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}

# Password validation
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

# Internationalization
# https://docs.djangoproject.com/en/5.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

LOGGING = {
    "version": 1,
    "disable_existing_loggers": False,
    "formatters": {
        "console": {
            "format": "%(asctime)s [%(levelname)s] %(name)s: %(message)s",
        },
    },
    "handlers": {
        "console": {
            "class": "logging.StreamHandler",
            "formatter": "console",
        },
    },
    "loggers": {
        "django": {
            "handlers": ["console"],
            "level": "DEBUG" if DEBUG else "INFO",
            "propagate": False,
        },
        "root": {
            "handlers": ["console"],
            "level": "DEBUG" if DEBUG else "INFO",
        },
    },
}

It doesn't look like it's breaking anything but it's clogging our logs and besides, having lingering exceptions is never a good thing.

Ofc, adding the following silences the exceptions since they are at the DEBUG level:

        "django.template": {
            "handlers": ["console"],
            "level": "ERROR",
            "propagate": False,
        },

Still, I would prefer not having to silence the template errors altogether just because I'm using the grappelli package.

petpevjp commented 4 days ago

I'm experiencing the same issue, were you able to resolve it?

jonasN5 commented 4 days ago

I'm experiencing the same issue, were you able to resolve it?

So far i'm stuck with silencing the logs.

sehmaschine commented 1 day ago

I'm able to reproduce this with when DEBUG is True (but not when it is False). But yes, if we try to resolve a variable which does not exist an exception is thrown. But that's intended behaviour, isn't it?

https://docs.djangoproject.com/en/5.1/ref/templates/api/#how-invalid-variables-are-handled

jonasN5 commented 23 hours ago

Well in that case we should not try to get invalid variables in DEBUG. I don't think logging a bunch of exceptions simply because DEBUG is set to true is acceptable.

sehmaschine commented 23 hours ago

Seems acceptable to me, but I see your point. So if someone wants to send a pull-request, we'll take a look at it.