最初的设置完毕以后,再添加的应用,只需要在Nginx里面进行少量修改,无需重启uwsgi,就能立刻部署完毕。uwsgi自带了基于django的监控uwsgi运行状态的工具,就拿它来部署好了:
server {listen 80;
root /var/www/django1.23;
index index.html index.htm;
server_name uwsgiadmin.django.obmem.info;
access_log /var/log/nginx/django.access.log;
location /media/ {
root /var/www/django1.23/adminmedia;
rewrite ^/media/(.*)$ /$1 break;
}
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9090;
uwsgi_param UWSGI_PYHOME /var/www/django1.23/vtenv;
uwsgi_param UWSGI_CHDIR /var/www/django1.23/uwsgiadmin;
uwsgi_param UWSGI_SCRIPT uwsgiadmin_wsgi;
}
}
于是uwsgi的监控信息可以在看到(用户名密码都是admin)。再比如LBForum论坛程序的部署:根据安装说明安装完毕,再按部署说明修改完配置文件,然后只需修改nginx配置文件:
server {listen 80;
root /var/www/django1.23;
index index.html index.htm;
server_name lbforum.django.obmem.info;
access_log /var/log/nginx/django.access.log;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9090;
uwsgi_param UWSGI_PYHOME /var/www/django1.23/vtenv;
uwsgi_param UWSGI_CHDIR /var/www/django1.23/LBForum/sites/default;
uwsgi_param UWSGI_SCRIPT lbforum_wsgi;
}
}
于是就是论坛程序了。
后记