【问题标题】:django app not being served on digitalocean dropletdjango 应用程序未在 digitalocean droplet 上提供服务
【发布时间】: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


【解决方案1】:

我必须通过运行命令sudo ufw allow 8080 来暴露端口 8000。教程中没有提到...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-29
    • 2017-11-17
    • 1970-01-01
    • 1970-01-01
    • 2020-04-10
    • 2020-09-27
    • 2020-08-18
    • 1970-01-01
    相关资源
    最近更新 更多