使用 Digital Ocean Droplet 设置我的应用程序后,如何让我的 django 网站向全世界开放?

How to make my django website live to the world after setting up my application with Digital Ocean Droplet?

我正在尝试使用 Digital Ocean Droplet 部署我的 Django 网站。我按照 this 文档使用 Nginx 和 Gunicorn 使用 Digital Ocean droplet 设置我的应用程序。在此之后,如果我在 bowser 中访问我的域名,该网站将在我的系统上正常 运行。但现在我很困惑,应该如何让我的网站通过互联网向全世界开放。以下是我根据我遵循的文档使用的 nginx 设置:

server {
    server_name 46.101.156.167;

    access_log off;

    location /static/ {
        alias /opt/myapp/static/;
    }

    location / {
        proxy_pass http://127.0.0.1:8001;
        proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
        add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
    }
}

上面给出的server_name是我的droplet的IP,重定向到我网站的域名。

如果有人可以通过逐步文档指导我使我的网站上线,那就太好了。我相信 Digital Ocean 应该从 git 或 bitbucket 中的 repo 获取我的网站,以便在进一步更改的情况下,我只需要将我的代码推送到 repo,而不是我的 droplet 可以使用更新代码。但是我很困惑如何去做。

请按照我在这里写的注意事项进行操作:

https://www.facebook.com/notes/django-python-web-framework/django-deployment-in-digitalocean-nginx-and-gunicorn/1012584968792749