从Django开始。在Ubuntu 16.04上,使用python3.6。在venv上启动了一个项目,并运行命令来启动Web服务器。这是输出
$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
January 03, 2019 - 14:06:57
Django version 2.1.4, using settings 'tictactoe.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
当我尝试访问本地主机时。我收到连接被拒绝的错误
$ curl -v http://127.0.0.1:8000/
* Trying 127.0.0.1...
* connect to 127.0.0.1 port 8000 failed: Connection refused
* Failed to connect to 127.0.0.1 port 8000: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 127.0.0.1 port 8000: Connection
refused
发现服务器未在端口8000上侦听。已通过netstat -an
python manage.py runserver 0:8000
也尝试了不同的端口,但没有帮助。