How to reproduce:
$ django-admin runserver --pythonpath=. --settings=tinyapp
Then open in browser URL http://127.0.0.1:8000/123 and see "Server Error (500)". Look at the console and see there is no stack trace
Created
October 16, 2020 19:02
-
-
Save lcd1232/f242d88b1eaeaccbb6ba2e81e68644cd to your computer and use it in GitHub Desktop.
Minimal django app for bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from django.conf.urls import url | |
from django.http import HttpResponse | |
DEBUG = False | |
ALLOWED_HOSTS = ["*"] | |
SECRET_KEY = '4l0ngs3cr3tstr1ngw3lln0ts0l0ngw41tn0w1tsl0ng3n0ugh' | |
ROOT_URLCONF = __name__ | |
def home(request): | |
return HttpResponse('Hello world') | |
urlpatterns = [ | |
url(r'^$', home), | |
] | |
TEMPLATES = [{ | |
"BACKEND": "django.template.backends.django.DjangoTemplates", | |
"DIRS": [os.path.dirname(os.path.realpath(__file__))], | |
"OPTIONS": { | |
"context_processors": ["tinyapp.context_proc"], | |
}, | |
} | |
] | |
LOGGING = { | |
"version": 1, | |
"disable_existing_loggers": False, | |
"filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}}, | |
"formatters": { | |
"verbose": { | |
"format": "%(levelname)s %(asctime)s %(module)s " | |
"%(process)d %(thread)d %(message)s" | |
} | |
}, | |
"handlers": { | |
"console": { | |
"level": "DEBUG", | |
"class": "logging.StreamHandler", | |
"formatter": "verbose", | |
}, | |
}, | |
"root": {"level": "INFO", "handlers": ["console"]}, | |
"loggers": { | |
"django.request": { | |
"handlers": ["console"], | |
"level": "ERROR", | |
"propagate": True, | |
}, | |
"django.security.DisallowedHost": { | |
"level": "ERROR", | |
"handlers": ["console"], | |
"propagate": True, | |
}, | |
}, | |
} | |
def context_proc(request): | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment