Django - 如何在生产服务器上 运行 它?

Django - how to run it on a production server?

我是 Django 项目的新手。我已将我的应用程序移至我的生产服务器并拥有它 运行:

$ python manage.py runserver
>>> Starting gulp watch
>>> gulp watch gulp process on pid 30427
Validating models...

0 errors found
May 18, 2017 - 15:57:08
Django version 1.5.12, using settings 'website.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

但是是生产服务器有IP,eg:119.237.27.131

所以不能运行宁在http://127.0.0.1:8000/

那我应该怎么做才能让应用 运行 宁 http://119.237.27.131:8000/ 呢?

有什么想法吗?

顺便说一下,'website.settings' 在哪里?

编辑:

当我在 http://119.237.27.131:8000/

查看应用程序时

我收到这个错误:

This site can’t be reached

119.237.27.131 refused to connect.

如果不带任何参数启动开发服务器,服务器会在localhost:8000启动,但不能从机器外访问。为此,您应该像这样启动服务器:

python manage.py runserver 0.0.0.0:8000

这将允许您从另一台机器连接到机器的 IP 地址,例如 http://119.237.27.131:8000/

一句警告:开发服务器不是生产就绪服务器。您应该使用 Gunicorn 之类的 WSGI 服务器或其他工具来为您的应用程序提供服务。不要在生产环境中使用开发服务器,这不安全!! Read more about that here.