1.安装django
python setup.py install
2.安装flup
python setup.py install
3.安装uwsgi
python uwsgiconfig.py --build
python setup.py install
4.创建项目
django-admin.py startproject Test
vi uwsgi.ini
#配置文件
[uwsgi]
socket = 127.0.0.1:9999
chdir = /Users/liuruichao/pythonSRC/django/helloworld
pythonpath = ..
env = DJANGO_SETTINGS_MODULE=helloworld.settings
module = wsgi
processes = 4
threads = 2
import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "helloworld.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
5.nginx 配置
erver { listen 80; server_name 192.168.0.100; location / { uwsgi_pass 127.0.0.1:9999; include uwsgi_params; } }
最后启动 uwsgi 和 nginx
nginx -s reload
uwsgi ./ugsgi.ini