django使用https

使用 runserver 是不能使用 https 的

解决办法:使用 runsslserver

步骤:

1.安装:

pip install django-extensions 
pip install django-werkzeug-debugger-runserver 
pip install pyOpenSSL

2.启动方式

python manage.py runsslserver 0.0.0.0:8100 \
--certificate /etc/pki/libvirt-spice/server-cert.pem \
--key /etc/pki/libvirt-spice/server-key.pem

3.修改setting.py中的INSTALLED_APPS

INSTALLED_APPS = (...
"sslserver",
...
)

你可能感兴趣的:(django使用https)