./manage.py 运行服务器 0.0.0.0:8000
我使用上面的行作为我从 github 借用的代码的一部分(https://github.com/ribeiroit/boh-puppet https://github.com/ribeiroit/boh-puppet)运行保持安装包。
到目前为止,http 还不错,但 https 还不行。如何修改上面的行以合并 https?我已经从 Comodo 获得了 ssl 证书并更新了我的 nginx conf.d 文件,但该网站不会以 https 形式显示。任何想法请按照我的方式进行。
谢谢
虽然塞萨尔的建议是django-extensions
对于使用 https 运行服务器是有效的,两者都不是runserver
or runserver_plus
应该在生产环境中使用。
Quoting Django 的文档 https://docs.djangoproject.com/en/2.1/ref/django-admin/#runserver:
请勿在生产环境中使用此服务器。它尚未经过安全审核或性能测试。 (这就是它的发展方向。我们的业务是制作 Web 框架,而不是 Web 服务器,因此改进该服务器以使其能够处理生产环境超出了 Django 的范围。)
Quoting django-extensions 的文档 https://django-extensions.readthedocs.io/en/latest/runserver_plus.html:
警告:这绝不应该在任何类型的生产环境中使用。即使是快速检查问题也不行。我怎么强调都不为过。交互式调试器允许您直接针对服务器评估 python 代码。你已被警告过。
现在是的,来自django-extensions
文档引用了一个功能,即交互式控制台,理论上,如果DEBUG
被设定为False
。但这正是如何Patreon 被黑了 https://labs.detectify.com/2015/10/02/how-patreon-got-hacked-publicly-exposed-werkzeug-debugger/,可能还有其他人。为什么还要冒险呢?
相反,最好使用官方推荐的一种来部署您的应用程序WSGI服务器 https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/例如gunicorn https://gunicorn.org/ or uWSGI https://uwsgi-docs.readthedocs.io/en/latest/.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)