Deployment in heroku, changing DEBUG = False results in a 500 error

Im using Django 1.9 and Python 3.4.3 . When changing DEBUG = False in my application, I get a 500 error on all pages of my application.

Note. An error 500 also appears on the Django admin page. Some other messages have reported that they do not receive this error on the admin page, and I do. I also tried everything in this post

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

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

STATICFILES_DIRS =(
    os.path.join(BASE_DIR, 'static'),
)

MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
+4
source share
3 answers

It is better if you add ADMINS to the settings:

ADMINS = (('Your name', 'Your@EMAIL'),)

, , .

,

+3

Whitenoise , . , . , , , .

, .
, , whitenoise . , : fooobar.com/questions/1212736/...

+2

, whitenoice settings.py MIDDLEWARE. settings.py WhiteNoise MIDDLEWARE_CLASSES, , Djangos SecurityMiddleware:

MIDDLEWARE_CLASSES = [
# 'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
#...
]

, DEBUG = True, DEBUG = False, . , Heroku , DEBUG = True, .

More details can be found in the whitenoise docs: http://whitenoise.evans.io/en/stable/django.html

Go through the step-by-step setup to see what you are missing. Heroku docs tend to skip the middleware add-on that is causing the error, and maybe there is something else missing for your application.

+2
source

Source: https://habr.com/ru/post/1618952/


All Articles