Re: [Django] #34451: Incorrect exception handling within the django exception handler

4 views
Skip to first unread message

Django

unread,
Mar 31, 2023, 4:02:15 PM3/31/23
to django-...@googlegroups.com
#34451: Incorrect exception handling within the django exception handler
--------------------------------+----------------------------------------
Reporter: Michael Galler | Owner: Akshat verma
Type: Bug | Status: assigned
Component: Core (Other) | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+----------------------------------------
Changes (by Akshat verma):

* owner: nobody => Akshat verma
* status: new => assigned


Comment:

#In settings.py
"""
Django settings for mysite project.

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

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

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

import os
import django_heroku
import dj_database_url

config = dj_database_url.config

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))


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

# SECURITY WARNING: keep the secret key used in production secret!
DEBUG = False

# Experimenting here
ALLOWED_HOSTS = ["localhost", "https://stormy-
stream-43261.herokuapp.com/"]

# Application definition

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

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'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 = 'mysite.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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 = 'mysite.wsgi.application'

# WSGI_APPLICATION = 'mysite.wsgi.application'
# from django.core.exceptions import ImproperlyConfigured

# def get_env_variable(var_name):
# try:
# return os.environ[var_name]
# except KeyError:
# error_msg = "Set the %s environment variable" % var_name
# raise ImproperlyConfigured(error_msg)

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

# one for development (maybe move that to local postgres) and another for
running and development
DATABASES = {

# 'default': {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': 'xsboediz',
# 'USER': 'xsboediz',
# 'PASSWORD': 'Qcn3tmpnSgp1QHgk_dsCvukFFPJAofm0',
# 'HOST': 'baasu.db.elephantsql.com',
# 'PORT': '5432'
# }

#
# 'default': dj_database_url.config(
# default=config('DATABASE_URL')
# )
#

'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'mydatabase',
}


}

# Password validation
# https://docs.djangoproject.com/en/2.0/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/2.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

#STATIC_URL = './blog/staticfiles/'
STATIC_URL = '/static/'

# STATICFILES_DIRS = (
# #'/Diversity_Policy_Site/blog/static',
# os.path.join(BASE_DIR, '/static/'),
# )
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

django_heroku.settings(locals())

--
Ticket URL: <https://code.djangoproject.com/ticket/34451#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 1, 2023, 7:00:35 AM4/1/23
to django-...@googlegroups.com
#34451: Incorrect exception handling within the django exception handler
--------------------------------+----------------------------------------
Reporter: Michael Galler | Owner: Akshat verma
Type: Bug | Status: assigned
Component: Core (Other) | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+----------------------------------------
Changes (by Akshat verma):

* owner: nobody => Akshat verma
* status: new => assigned

Django

unread,
Apr 3, 2023, 2:13:36 AM4/3/23
to django-...@googlegroups.com
#34451: Incorrect exception handling within the django exception handler
---------------------------------+----------------------------------------

Reporter: Michael Galler | Owner: Akshat verma
Type: Bug | Status: assigned
Component: Error reporting | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------
Changes (by Mariusz Felisiak):

* component: Core (Other) => Error reporting
* stage: Unreviewed => Accepted


Comment:

> If I interpret this correctly, the problem is that the exception handler
tries to render the 500 page, which imports the urls which leads to the
same error.

Tentatively accepted for future investigation. It seems that at least
`resolve_error_handler()`/`get_caller()` should handle errors when
checking the URLconf/resolving paths.

--
Ticket URL: <https://code.djangoproject.com/ticket/34451#comment:6>

Django

unread,
Apr 3, 2023, 1:48:42 PM4/3/23
to django-...@googlegroups.com
#34451: Incorrect exception handling within the django exception handler
---------------------------------+----------------------------------------
Reporter: Michael Galler | Owner: Akshat verma
Type: Bug | Status: assigned
Component: Error reporting | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------
Changes (by Akshat verma):

* owner: nobody => Akshat verma
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/34451#comment:7>

Django

unread,
Apr 4, 2023, 9:47:49 AM4/4/23
to django-...@googlegroups.com

Django

unread,
Aug 31, 2023, 6:35:15 AM8/31/23
to django-...@googlegroups.com
#34451: Incorrect exception handling within the django exception handler
---------------------------------+----------------------------------------
Reporter: Michael Galler | Owner: Akshat verma
Type: Bug | Status: assigned
Component: Error reporting | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------

Comment (by Enrique Matías Sánchez):

Possibly related to
https://github.com/vitalik/django-ninja/issues/723

--
Ticket URL: <https://code.djangoproject.com/ticket/34451#comment:8>

Reply all
Reply to author
Forward
0 new messages