如何 运行 django 项目上线

How to run django project live

我用 Django 开发了几个网站。现在我想看他们直播。我已经购买了 VPS 服务器 主机。所有设置都像 pip/applications 。此外,当我在 运行 服务器时,它显示

Django version 1.11, using settings 'wer.settings'

Starting development server at http://127.0.0.1:8000/

Quit the server with CONTROL-C.

但我不知道为什么它没有显示在我的域中。

我需要对 settings.py 文件进行哪些更改才能在我的域中显示它或实时托管它。 是否不可能使用相同的命令:-

python manage.py runserver 

Gunicorn、nginx、supervisor提供良好稳定的生产环境。更多细节在这里; https://hackernoon.com/deploy-django-app-with-nginx-gunicorn-postgresql-supervisor-9c6d556a25ac

注意:这篇文章不是我写的,但它提供了足够的信息让你到达那里。

django 中的 Runserver 不适用于生产,但如果您想在实时环境中进行测试,请使用:

python manage.py runserver  0.0.0.0:8000

使用你的vps服务器ip浏览网站

http://vps_server_ip:8000

这里是 Setting up Django and your web server with uWSGI and nginx

的指南