./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 运行服务器是有效的,但是 runserver
或 runserver_plus
都不应该用于生产环境。
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 之一来部署您的应用程序例如gunicorn或 uWSGI .
关于python - ./manage.py runserver 使用 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52120747/