使用 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", ... )
終。