Django使用https及uwsgi配置

需要下载的库

$ pip3 install django-extensions
$ pip3 install django-werkzeug-debugger-runserver
$ pip3 install pyOpenSSL

配置django的setting.py

INSTALLED_APPS = [
    '...',
    'werkzeug_debugger_runserver',
    'django_extensions',
]

调试启动

$ nohup python3 manage.py runserver_plus --cert-file api.crt --key-file api.key 0.0.0.0:8000 > /dev/null 2>&1 &

uwsgi配置

[uwsgi]
master = true
processes = 1
threads = 2
chdir = /www/wwwroot/xxx
https = 0.0.0.0:8000,/www/wwwroot/xxx/api.crt,/www/wwwroot/xxx/api.key
logto = /www/wwwroot/xxx/logs/error.log
chmod-socket = 660
vacuum = true
master = true
max-requests = 1000
wsgi-file=/www/wwwroot/xxx/xxx/wsgi.py
daemonize = /www/wwwroot/xxx/logs/error.log

本文链接:

https://www.zaigie.com/archives/204/