在Heroku上的Bad Request 400 Django App

时间:2018-07-23 23:47:38

标签: python django heroku heroku-postgres heroku-cli

伙计们,在heroku中部署django应用程序时出现问题 这是我的procfile

web:gunicorn drf.wsgi:application --log-file -
web: python manage.py runserver 0.0.0.0:$PORT

wsgi.py

import os
from whitenoise.django import DjangoWhiteNoise

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "drf.settings")

application = get_wsgi_application()
application = DjangoWhiteNoise(application)

还添加了允许的主机

  ALLOWED_HOSTS = ['mxiondrf.herokuapp.com']

这是我的日志

18-07-23T23:34:50.814903+00:00 heroku[router]: at=info method=GET path="/" host=mxiondrf.herokuapp.com request_id=f4f07d1
b-be4a-4f62-85e0-6701c420da1c fwd="103.49.121.34" dyno=web.1 connect=0ms service=93ms status=400 bytes=154 protocol=https
2018-07-23T23:34:51.408577+00:00 app[web.1]: [23/Jul/2018 23:34:51] "GET /favicon.ico HTTP/1.1" 400 26
2018-07-23T23:34:51.410953+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=mxiondrf.herokuapp.com request
_id=951b1ad8-0716-43c0-b21e-a8390ff59e63 fwd="103.49.121.34" dyno=web.1 connect=0ms service=79ms status=400 bytes=154 proto
col=https
2018-07-23T23:34:54.506740+00:00 heroku[router]: at=info method=GET path="/" host=mxiondrf.herokuapp.com request_id=581d35d
6-bdf3-49f9-9c4f-a74d6c39da08 fwd="103.49.121.34" dyno=web.1 connect=1ms service=60ms status=400 bytes=154 protocol=https
2018-07-23T23:34:54.506394+00:00 app[web.1]: [23/Jul/2018 23:34:54] "GET / HTTP/1.1" 400 26
2018-07-23T23:34:55.006560+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=mxiondrf.herokuapp.com request
_id=c0c33673-f212-4679-ada8-7e7719e283eb fwd="103.49.121.34" dyno=web.1 connect=0ms service=124ms status=400 bytes=154 prot
ocol=https
2018-07-23T23:34:55.004234+00:00 app[web.1]: [23/Jul/2018 23:34:55] "GET /favicon.ico HTTP/1.1" 400 26

感谢任何帮助

1 个答案:

答案 0 :(得分:1)

您在Procfile中只能有一个Web条目

它应该显示为

web: gunicorn mysite.wsgi
相关问题