所以我试图将我的 django 项目部署到 heroko,我得到了这个。
我知道这里有什么问题,所以我已将 url 添加the-yogify.herokuapp.com
到ALLOWED_HOST
我的 django 项目的 settings.py 文件中。
ALLOWED_HOSTS = ['http://the-yogify.herokuapp.com/',
'https://the-yogify.herokuapp.com/',
'the-yogify.herokuapp.com',
'the-yogify.herokuapp.com/',
'127.0.0.1']
但错误仍然存在。
我在这里做错了什么?我认为实际的错误可能是别的。
所以我打印了heroku日志,它也显示了同样的错误。
2020-11-24T04:10:53.978271+00:00 app[web.1]: [2020-11-24 04:10:53 +0000] [4] [INFO] Starting gunicorn 20.0.4
2020-11-24T04:10:53.979367+00:00 app[web.1]: [2020-11-24 04:10:53 +0000] [4] [INFO] Listening at: http://0.0.0.0:25352 (4)
2020-11-24T04:10:53.979552+00:00 app[web.1]: [2020-11-24 04:10:53 +0000] [4] [INFO] Using worker: sync
2020-11-24T04:10:53.991703+00:00 app[web.1]: [2020-11-24 04:10:53 +0000] [10] [INFO] Booting worker with pid: 10
2020-11-24T04:10:54.026534+00:00 app[web.1]: [2020-11-24 04:10:54 +0000] [11] [INFO] Booting worker with pid: 11
2020-11-24T04:10:54.200285+00:00 heroku[web.1]: State changed from starting to up
2020-11-24T04:10:57.847722+00:00 app[web.1]: Invalid HTTP_HOST header: 'the-yogify.herokuapp.com'. You may need to add 'the-yogify.herokuapp.com' to ALLOWED_HOSTS.
2020-11-24T04:10:58.083555+00:00 app[web.1]: Bad Request: /
2020-11-24T04:10:58.092696+00:00 app[web.1]: 10.11.198.97 - - [24/Nov/2020:04:10:58 +0000] "GET / HTTP/1.1" 400 59515 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 Edg/86.0.622.51"
2020-11-24T04:10:58.099353+00:00 heroku[router]: at=info method=GET path="/" host=the-yogify.herokuapp.com request_id=dafb2e9e-fd1c-49d7-8375-fb0b707ef5bc fwd="42.111.13.118" dyno=web.1 connect=1ms service=2796ms status=400 bytes=59767 protocol=https
2020-11-24T04:10:59.830985+00:00 app[web.1]: Invalid HTTP_HOST header: 'the-yogify.herokuapp.com'. You may need to add 'the-yogify.herokuapp.com' to ALLOWED_HOSTS.
谢谢你的时间。