python - ./manage.py runserver 使用 https

标签 python django ssl nginx

./manage.py runserver 0.0.0.0:8000

我使用上面的行作为我从 github (https://github.com/ribeiroit/boh-puppet) 借来的代码的一部分来运行安装包。

到目前为止,在 http 上一切顺利,但在 https 上表现不佳。如何修改上面的行以合并 https?我已经从 Comodo 获得了 ssl 证书并更新了我的 nginx conf.d 文件,但该网站不会以 https 显示。任何想法请按照我的方式进行。

谢谢

最佳答案

虽然 cezar 对 django-extensions 的推荐对于使用 https 运行服务器是有效的,但是 runserverrunserver_plus 都不应该用于生产环境。

引用 Django's documentation :

DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)

引用 django-extensions' documentation :

WARNING: This should never be used in any kind of production environment. Not even for a quick problem check. I cannot emphasize this enough. The interactive debugger allows you to evaluate python code right against the server. You’ve been warned.

是的,django-extensions 文档中的这个警告是针对单个功能的,即交互式控制台,如果设置了 DEBUG,理论上不会公开该功能为 False。但这正是 Patreon got hacked 的方式,可能还有其他人。为什么还要冒险?

相反,最好使用官方推荐的 WSGI servers 之一来部署您的应用程序例如gunicornuWSGI .

关于python - ./manage.py runserver 使用 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52120747/

相关文章:

python - 从Python中的曲面图中删除阴影

python - 嵌套元组的最大值

python - 是否可以创建一个 Python 列表并伪造它?

javascript - 了解用于 Web 开发的 Eclipse 项目性质和工作流程

python - 在 Django 中获取当前服务器 ip 或域

python - 如何在 pandas 和 Jupyter Notebook 中创建一个带有指向本地文件的可点击超链接的表格

mysql - Django 单元测试全文搜索

用于发出 HTTPS 请求的 C++ 高级网络库

c# - ClientWebsocket SSL 证书验证失败

ssl - HTTPS Web(仅)代理