使用调试等于false的故障排除服务器错误500

时间:2019-05-16 15:45:19

标签: ssl heroku

在运行Django 2.2.1的Heroku服务器上,我只有DEBUG = False。

我最近添加了以下代码以在本地服务器环境和heroku服务器环境之间进行检测。

if os.environ['HOME'] == '/home/justin':
    DEBUG = True
    SECURE_SSL_REDIRECT = False
else:
    DEBUG = False
    SECURE_SSL_REDIRECT = True

从heroku日志--tail

2019-05-16T15:35:03.000000+00:00 app[api]: Build succeeded

2019-05-16T15:35:06.794070+00:00 heroku[router]: at=info method=GET path="/" host=XXX.XXX.com request_id=dcfc99a3-336e-4982-85df-e719dfe9479d fwd="45.62.189.94" dyno=web.1 connect=1ms service=3ms status=301 bytes=243 protocol=http

2019-05-16T15:35:06.793464+00:00 app[web.1]: 10.7.164.30 - - [16/May/2019:15:35:06 +0000] "GET / HTTP/1.1" 301 0 "-" "Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Firefox/60.0"

2019-05-16T15:35:07.625145+00:00 heroku[router]: at=info method=GET path="/" host=XXX.XXX.com request_id=139cb31a-da0c-4182-bee0-fad66d60b2bf fwd="45.62.189.95" dyno=web.1 connect=0ms service=643ms status=500 bytes=234 protocol=https

2019-05-16T15:35:07.623647+00:00 app[web.1]: 10.7.159.85 - - [16/May/2019:15:35:07 +0000] "GET / HTTP/1.1" 500 27 "-" "Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Firefox/60.0"

0 个答案:

没有答案