django配置 wsgi和nginx
官方文档
https://uwsgi-docs-zh.readthedocs.io/zh_CN/latest/tutorials/Django_and_nginx.html
下载uwsgi
pip install uwsgi
创建测试文件
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"]
这是python 3的,需要添加byte
运行uwsgi
uwsgi --http :8000 --wsgi-file 绝对位置/test.py
现在使用本地8000端口查看
这意味着uwegi运行正常
用wsgi命令启动django项目
首先我们进入项目同名目录的一级目录,就是两个同名文件夹中最高级的那一级路径,在命令行中键入
uwsgi --http :8000 --module 模块名(同名文件夹名字).wsgi
可以开启django项目