部署到heroku更改DEBUG = False会导致500错误 [英] Deploying to heroku changing DEBUG = False results in 500 error

查看:109
本文介绍了部署到heroku更改DEBUG = False会导致500错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Django 1.9 Python 3.4.3 . 在我的应用程序上更改DEBUG = False时,我在应用程序的所有页面上都收到500错误.

Im using Django 1.9 and Python 3.4.3. When changing DEBUG = False on my app I'm getting a 500 error on all pages of my app.

注意:Django管理页面也会导致500错误.一些 其他帖子报告没有在管理页面上收到此错误,我是.我也在此帖子

Note: The Django admin page results in a 500 error as well. Some other posts reported not getting this error on the admin page and I am. I have 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')

推荐答案

如果将ADMINS添加到设置中,效果会更好:

It will be better if you add the ADMINS to the settings:

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

当发生错误时,您将收到更好的报告,可用于调试错误.

With that you'll receive a better report when the error occur that you can use to debug the error.

希望有帮助

这篇关于部署到heroku更改DEBUG = False会导致500错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆