-
下载uwsgi
pip3 install uwsgi
-
确保使用python manager.py runserver可以启动Django项目
-
使用uwsgi命令行方式验证项目是否可以启动
uwsgi --http 127.0.0.1:8800 --file application/wsgi.py
-
配置uwsgi配置文件
[uwsgi] #启动uwsgi的用户名和用户组 uid=centos gid=centos http = 0.0.0.0:8800 # 所有人都可以访问 # scoket = 0.0.0.0:8001 # 仅能本机访问 chdir = /app/pybill/ wsgi-file = /app/pybill/application/wsgi.py socket=/app/script/uwsgi.sock pidfile=/app/script/uwsgi.pid master=true process = 4 # 开启进程数 threads = 4 # 开启线程数 #自动移除unix socket和pid文件当服务停止的时候 vacuum=true #序列化接受的内容,如果可能的话 thunder-lock=true #启用线程 enable-threads=true #设置自中断时问 harakiri=30 #设置缓冲 post-buffering=4096 #设置日志目录 daemonize=/app/script/uwsgi.log
[uwsgi] uid=www-data # Ubuntu系统下默认用户名 gid=www-data # Ubuntu系统下默认用户组 project=mysite1 # 项目名 base = /home/user1 # 项目根目录
05-31
595

04-07
5万+
