项目部署 ubuntu Django uwsgi配置

时间:2022-12-14 07:48:18

1.进入项目文件夹

  mkdir uwsgi_file

  vim uwsgi.ini

  写入保存

 [uwsgi]

 chdir           = /home/mysite/my_project        # 项目目录
module = my_project.wsgi:application # wsgi所在目录
# home = /root/.virtualenvs/mywork # 虚拟环境目录 缺省 master = true # 主进程
processes = # 进程数
harakiri =
max-requests = socket=127.0.0.1: #端口
# http=127.0.0.1:
uid =
gid =
pidfile =/home/mysite/my_project/uwsgi_file/uwsgi.pid
daemonize = /home/mysite/my_project/uwsgi_file/uwsgi.log #日志
vacuum = true 后台开启

2.重启Nginx

  service nginx restart

3.开启setting debug = True

4.启动uwsgi

  启动 uwsgi --ini uwsgi.ini (路径)        停止:ps -aux | grep uwsgi |awk '{print $2}'|xargs kill -9

5.成功(显示Django欢迎界面)