【发布时间】:2020-11-13 13:21:02
【问题描述】:
在 Heroku 上使用 DEBUG=True 的 Dajango (+channels/postgres/redis) 应用运行良好,没有错误,没有异常。如果 DEBUG=False 那么它实际上根本不起作用,error500。一些线索如何以这样的方式涉及 DEBUG 标志?谢谢。
Heroku 日志示例,DEBUG=True(工作正常):
GET path="/"
“GET/HTTP/1.1”302
“GET /accounts/login/?next=/HTTP/1.1”200
2020-07-23T16:14:24.496575+00:00 heroku[router]: at=info method=GET path="/" host=immense-escarpment-72885.herokuapp.com request_id=78bccd24-e86e-481f-995e-0aa31b2e440d fwd="68.14.159.220" dyno=web.1 connect=1ms service=117ms status=302 bytes=240 protocol=https
2020-07-23T16:14:24.495692+00:00 app[web.1]: 68.14.159.220:0 - "GET / HTTP/1.1" 302
2020-07-23T16:14:24.705467+00:00 app[web.1]: 68.14.159.220:0 - "GET /accounts/login/?next=/ HTTP/1.1" 200
登录页面显示,OK。
现在的问题:唯一的区别是 DEBUG=False:
GET path="/"
用户警告:没有目录:/app/pickupteaming/staticfiles/
“GET/HTTP/1.1”302
"GET /accounts/login/?next=/HTTP/1.1" 500
Heroku 日志示例详述如下:
2020-07-23T16:17:32.649059+00:00 heroku[router]: at=info method=GET path="/" host=immense-escarpment-72885.herokuapp.com request_id=22b8a783-04e8-4fda-a185-f0f39c69125e fwd="68.14.159.220" dyno=web.1 connect=0ms service=125ms status=302 bytes=240 protocol=https
2020-07-23T16:17:32.527579+00:00 app[web.1]: /app/.heroku/python/lib/python3.7/site-packages/whitenoise/base.py:116: UserWarning: No directory at: /app/pickupteaming/staticfiles/
2020-07-23T16:17:32.527606+00:00 app[web.1]: warnings.warn(u"No directory at: {}".format(root))
2020-07-23T16:17:32.643881+00:00 app[web.1]: 68.14.159.220:0 - "GET / HTTP/1.1" 302
2020-07-23T16:17:32.733941+00:00 app[web.1]: 68.14.159.220:0 - "GET /accounts/login/?next=/ HTTP/1.1" 500
2020-07-23T16:17:32.739475+00:00 heroku[router]: at=info method=GET path="/accounts/login/?next=/" host=immense-escarpment-72885.herokuapp.com request_id=991497fb-57f9-42f6-ae6b-c4a85dcdc79c fwd="68.14.159.220" dyno=web.1 connect=0ms service=60ms status=500 bytes=353 protocol=https
【问题讨论】:
标签: django heroku build django-staticfiles