墨氺 2016-06-29
全部安装好之后
不用python manage.py runserver 而是用uwsgi uwsgi.ini命令, 其中uwsgi.ini是写的uwsgi配置文件,
[uwsgi] socket = 127.0.0.1:3031 chdir = /home/david/project wsgi-file = xxx/wsgi.py processes = 4 threads = 2 stats = 127.0.0.1:9191
然后nginx.conf中对应的转发的配置
server{ listen 8080; ................................此处省略 location / { include uwsgi_params; uwsgi_pass 127.0.0.1:3031; } }
想在后台不中断的运行,nohup uwsgi uwsgi.ini > /home/david/nohup.out 2>&1 &
现在在本机浏览器里访问http://localhost:8080/, OK
如果是用的virtualenv 配置的sample
1 [uwsgi] 2 socket = :2345 3 master = true 4 processes = 12 5 harakiri = 1800 6 #buffer-size = 32768 7 #post-buffering = true 8 #post-buffering-buffersize = 32768 9 max-requests = 500 10 gid=rit 11 uid=david 12 chdir = /david/clarity 13 module=clarity.wsgi:application 14 pp=/david/clarity 15 pp=/home/david/.env/clarity/lib/python2.6/site-packages/ #看这里 16 #pythonpath=/home/david/.env/clarity/bin/python 17 env=clarity.production 18 reload-on-as = 512 19 reload-on-rss = 192