抱歉,您的浏览器无法访问本站

本页面需要浏览器支持(启用)JavaScript


了解详情 >

记录一下,方便使用

开关uwsgi-django网站

关闭uwsgi服务

1
2
3
4
5
6
7
8
ps ax | grep uwsgi
得到类似
15005 pts/4 S 0:00 /ve/path/bin/uwsgi --ini config.ini
15006 pts/4 S 0:00 /ve/path/bin/uwsgi --ini config.ini
15007 pts/4 S 0:00 /ve/path/bin/uwsgi --ini config.ini
地址是/ve/path/bin/uwsgi
杀死
killall -s INT /ve/path/bin/uwsgi

到对应目录开启虚拟环境

1
cd /www/wwwroot/shuai4-django-env&&source bin/activate

用配置文件启动

1
uwsgi -d --ini shuai4-django.ini

更新以后的开启重载关闭uwsgi方式

1
2
3
4
5
6
#开启
/www/wwwroot/shuai4-django-env3.7/bin/uwsgi -d --ini /www/wwwroot/shuai4-django-env3.7/shuai4-django.ini --log-reopen
#重载
/www/wwwroot/shuai4-django-env3.7/bin/uwsgi --reload /www/wwwroot/shuai4-django-env3.7/uwsgi.pid
#关闭
/www/wwwroot/shuai4-django-env3.7/bin/uwsgi --stop /www/wwwroot/shuai4-django-env3.7/uwsgi.pid

部署uwsgi-django网站时用到的

导出导入包

1
2
3
4
#导出
pip freeze > requirements.txt
#导入
pip install -r requirements.txt

debian安装pip

1
sudo apt-get install python3-pip

安装虚拟环境包

1
pip3 install virtualenv

创建文件夹

1
mkdir /var/www

移动到该文件夹

1
cd /var/www

创建虚拟环境

1
virtualenv studyapi

进入虚拟环境

1
source studyapi/bin/activate

安装7z

1
apt install p7zip-full

解压项目到当前文件夹

1
7z x dwebsite.zip

解压项目到当前文件夹

1
7z x dwebsite.zip

uwsgi配置文件

1
2
3
4
5
6
7
8
9
10
[uwsgi]
chdir =/www/wwwroot/shuai4-django-env/shuai4-django
module =shuai4.wsgi
home =/www/wwwroot/shuai4-django-env/
master =true
processes =4
socket =127.0.0.1:9090
chmod-socket = 666
vacuum = true
pidfile=uwsgi.pid

nginx配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
server
{
listen 8097;
server_name 49.232.5.6;
location /static {
alias /www/wwwroot/shuai4-django-env/shuai4-django/collected_static;
}
location / {
uwsgi_pass 127.0.0.1:9090;
include /www/server/panel/vhost/nginx/uwsgi_params;
client_max_body_size 20m;
}

access_log /www/wwwlogs/49.232.5.6.log;
error_log /www/wwwlogs/49.232.5.6.error.log;
}

评论