我目前正尝试在tutorial之后部署我的网站。但是我遇到了一些可访问性问题:
对于我的应用程序,即使正在监听0.0.0.0
,也仍然无法通过外部IP地址对其进行访问:
$ flask run --host 0.0.0.0
* Environment: development
* Debug mode: on
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: xxx-xxx-xxx
/fakepath/.venv/lib/python3.8/site-packages/flask/sessions.py:220: UserWarning: The session cookie domain is an IP address. This may not work as intended in some browsers. Add an entry to your hosts file, for example "localhost.localdomain", and use that instead.
"The session cookie domain is an IP address. This may not work"
127.0.0.1 - - [08/Dec/2019 17:20:03] "GET / HTTP/1.1" 200 -
xxx.xxx.xxx.xxx - - [08/Dec/2019 17:20:05] "GET / HTTP/1.1" 404 - # external IP address of the host
$ curl http://127.0.0.1:5000
<html> ... # correct page
$ curl http://xxx.xxx.xxx.xxx:5000 # external IP address of the host
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
但是,当我尝试使用DigitalOcean中的Hello World应用程序时,它实际上按照本教程中的说明工作。