安装好测试
def application(dev,start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b'Hello World']

运行uwsgi:
uwsgi --http :8000 --wsgi-file test.py


测试uwsgi运行是否正常
curl 39.97.116.6:8000
用这个ip配置uwsgi的socket

找到项目根目录

配置chdir = /home/machunliang/xceshi_pro

配置wsgi-file=xceshi/wsgi.py
# 进程数
processes=4
# 线程数
threads=2
# uwsgi服务器的角色
master=true
# 存放进程编号的文件
pidfile=uwsgi.pid
# 日志文件,因为uwsgi可以脱离终端在后台运行,日志看不见。以前的runserver是依赖终端的
daemonize=logs/uwsgi.log
# 指定虚拟环境所在目录,不能填相对目录
virtualenv=/home/machunliang/.virtualenvs/xceshi_prod
网友评论