1.進入項目文件夾nginx
mkdir uwsgi_filevim
vim uwsgi.iniapp
寫入保存socket
1 [uwsgi] 2 3 chdir = /home/mysite/my_project # 項目目錄 4 module = my_project.wsgi:application # wsgi所在目錄 5 # home = /root/.virtualenvs/mywork # 虛擬環境目錄 缺省 6 7 master = true # 主進程 8 processes = 4 # 進程數 9 harakiri =60 10 max-requests = 5000 11 12 13 14 socket=127.0.0.1:8001 #端口 15 # http=127.0.0.1:8001 16 uid = 1000 17 gid = 2000 18 pidfile =/home/mysite/my_project/uwsgi_file/uwsgi.pid 19 daemonize = /home/mysite/my_project/uwsgi_file/uwsgi.log #日誌 20 vacuum = true 後臺開啓 21 22 23
2.重啓Nginxui
service nginx restartspa
3.開啓setting debug = Truedebug
4.啓動uwsgirest
啓動 uwsgi --ini uwsgi.ini (路徑) 中止:ps -aux | grep uwsgi |awk '{print $2}'|xargs kill -9日誌
5.成功(顯示Django歡迎界面)code