【发布时间】:2018-11-22 17:49:05
【问题描述】:
我在网上关注这个教程https://simpleisbetterthancomplex.com/tutorial/2016/10/14/how-to-deploy-to-digital-ocean.html
我进入了一个中间步骤,我想检查我是否可以通过 IP 地址访问应用程序。我运行python manage.py runserver 0.0.0.0:8000,它返回以下内容:
System check identified no issues (0 silenced).
November 22, 2018 - 17:41:08
Django version 2.1.3, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
所以没有错误。然后我导航到my_droplet_ip:8000,我得到了超时。 “响应时间过长。”
我从用户而不是 root 运行 runserver 命令。不知道这是否重要...
知道这里发生了什么吗?
【问题讨论】:
-
尝试从本地机器
telnet your_ip 8000,可能8000端口默认关闭外部连接 -
好的,我发现我需要在服务器上公开我的端口
sudo ufw allow 8000
标签: django ip digital-ocean droplet