【问题标题】:Bad Request 400 Django App on HerokuHeroku 上的错误请求 400 Django 应用程序
【发布时间】:2018-12-31 11:37:48
【问题描述】:

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

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

感谢任何形式的帮助

【问题讨论】:

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


【解决方案1】:

Procfile 中应该只有一个网络条目

它应该是

web: gunicorn mysite.wsgi

【讨论】:

    猜你喜欢
    • 2018-08-24
    • 2016-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-08
    • 1970-01-01
    • 2023-03-24
    • 2021-12-07
    相关资源
    最近更新 更多