django部署

https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-16-04

 https://www.cnblogs.com/chenice/p/6921727.html

 

在项目根目录(manage.py的目录)下执行启动命令,注意最后的 static参数,没有的时候按照网上的方法一直没有样式

uwsgi --http :8002 --chdir /home/guchen/python/www/for_test/AutoTestSite/ --wsgi-file AutoTestSite/wsgi.py --master --processes 4 --threads 2 --stats 127.0.0.1:8003 --static-map=/static=/home/guchen/python/www/for_test/AutoTestSite/static2

命令启动:到项目根目录下执行 

uwsgi --ini uwsgi.ini

  

uwsgi.ini配置文件内容

[uwsgi]
#项目根目录
chdir = /home/guchen/DjangoProject/AutoTestSite

#指定wsgi模块
module = AutoTestSite.wsgi:application 

#对外提供8000端口,访问ip+8000+路由地址 #socket
= 127.0.0.1:8000 #对本机8000端口提供服务,到时就是访问ip:8002+路由地址 http =:8004 #主进程 master = true processes = 2 #多站模式 vhost = true #no-site = true //多站模式时不设置入口模块和文件 #workers = 2 //子进程数 #reload-mercy = 10 #vacuum = true //退出、重启时清理文件 #max-requests = 1000 #limit-as = 512 #buffer-size = 30000 #pid文件,用于下脚本启动、停止该进程 pidfile = /var/run/uwsgi9090.pid #log地址,启动时就不在控制台输出log了 daemonize = /home/guchen/DjangoProject/AutoTestSite/run.log #不记录正常信息,只记录错误信息 disable-logging = true #指定静态文件地址 static-map=/static=/home/guchen/DjangoProject/AutoTestSite/static

 

posted @ 2018-12-16 22:21  秋寻草  阅读(134)  评论(0编辑  收藏  举报