我知道这个问题已经在这里讨论了上千次,但是我一直停不下来,因为我很难找到这个问题的原因和可行的解决方案。所以,我的问题是DEBUG=True
在heroku上,一切正常,如果将其设置为False
,则会出现服务器错误(500)。请帮帮我!
我尝试过但不起作用的事情:
collectstatic
,然后尝试添加,提交和推送到Heroku,但是没有用。ALLOWED_HOSTS = ["herokuapp.com"]
我的wsgi.py
文件如下:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings")
application = get_wsgi_application()
我看到的heroku日志:
2019-01-05T17:41:17.844144+00:00 app[web.1]: [2019-01-05 17:41:17 +0000] [10] [INFO] Booting worker with pid: 10
2019-01-05T17:41:17.857502+00:00 app[web.1]: [2019-01-05 17:41:17 +0000] [11] [INFO] Booting worker with pid: 11
2019-01-05T17:41:18.234497+00:00 app[web.1]: base dir path /app
2019-01-05T17:41:18.240629+00:00 app[web.1]: local settings failed
2019-01-05T17:41:18.357015+00:00 app[web.1]: base dir path /app
2019-01-05T17:41:18.358185+00:00 app[web.1]: local settings failed
2019-01-05T17:41:19.010564+00:00 heroku[web.1]: State changed from starting to up
2019-01-05T17:41:21.230071+00:00 app[web.1]: 10.28.83.116 - - [05/Jan/2019:17:41:21 +0000] "GET / HTTP/1.1" 500 27 "https://dashboard.heroku.com/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0"
2019-01-05T17:41:21.230836+00:00 heroku[router]: at=info method=GET path="/" host=obscure-dusk-29347.herokuapp.com request_id=b5fb4554-fa37-4e39-b710-fae1ac8c6651 fwd="103.208.75.78" dyno=web.1 connect=1ms service=184ms status=500 bytes=234 protocol=https
2019-01-05T17:41:21.670528+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=obscure-dusk-29347.herokuapp.com request_id=0d271d43-17a0-4b37-aff1-51767d192d35 fwd="103.208.75.78" dyno=web.1 connect=1ms service=20ms status=404 bytes=266 protocol=https
答案 0 :(得分:0)
我终于做到了!
我的call dbms_output.put_line(charcount('&textinput'));
中的DEBUG
变量就像settings.py
。因此,我只是将其更改为DEBUG = config('DEBUG', default=False, cast=bool)
并且有效。