我在negrok上遇到问题,它没有启动我的本地django Web服务器,几天前一切正常,但是正常的一天,没有碰任何东西,它就停止了工作。
运行以下命令:
python manage.py runserver
一切正常正常。
现在我执行以下命令,以启动本地django服务器:
./ngrok http 8000
ngrok可以正常运行,没有任何问题,但是在访问ngrok链接时,页面正在加载,并且所有内容都为空白,并且无法正常工作....
它出现在ngrok中:
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Account Julio (Plan: Free)
Version 2.3.34
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://33822c5a.ngrok.io -> http://localhost:8000
Forwarding https://33822c5a.ngrok.io -> http://localhost:8000
Connections ttl opn rt1 rt5 p50 p90
2 0 0.03 0.01 0.20 0.21
HTTP Requests
-------------
GET / 400 Bad Request
GET / 400 Bad Request
这出现在Django中:
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
September 25, 2019 - 17:23:19
Django version 2.2.2, using settings 'ibme_proyect.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Invalid HTTP_HOST header: '33822c5a.ngrok.io'. You may need to add '33822c5a.ngrok.io' to ALLOWED_HOSTS.
Bad Request: /
[25/Sep/2019 17:25:30] "GET / HTTP/1.1" 400 68119
Invalid HTTP_HOST header: '33822c5a.ngrok.io'. You may need to add '33822c5a.ngrok.io' to ALLOWED_HOSTS.
Bad Request: /
[25/Sep/2019 17:25:38] "GET / HTTP/1.1" 400 68254
我在33822c5a.ngrok.io
中添加了ngrok主机(ALLOWED_HOSTS
),并停止提供django错误,并访问了ngrok链接,我知道它会再次加载,它不会加载HTML,什么也没有,一切一片空白...
有解决方案吗? :(
答案 0 :(得分:1)
尝试 ALLOWED_HOSTS = [“ *”] 这将允许每次运行ngrok时使用隧道:)