Linux配置uwsgi环境

Linux配置uwsgi环境

1.进入虚拟环境

source /envs/django_-shop-system/bin/activate

2.安装uwsgi

 pip install uwsgi

3.基于uwsgi运行项目 – 基于配置文件

在项目目录下创建配置文件

#socket= 0.0.0.0:8005
http= 0.0.0.0:8005
# http=120.55.47.111:8005
chdir=/opt/www/django_-shop-system/
wsgi-file = /opt/www/django_-shop-system/JiXuShopSystem/wsgi.py
#callable = application
processes = 2
threads = 2
virtualenv = /envs/django_-shop-system/
master=True
pidfile=uwsgi.pid
uid = 2001
gid = 1001
buffer-size = 65536
static-map = /static=/opt/www/django_-shop-system/static/

进入项目目录激活虚拟环境

cd /opt/www/django_-shop-system
source /envs/django_-shop-system/bin/activate

运行uwsgi

uwsgi --ini django_-shop-system_uwsgi.ini

uwsgi --stop uwsgi.121339

后台运行

uwsgi --ini django_-shop-system_uwsgi.ini &

针对运行比较麻烦我们可以穿件shell脚本

shell脚本

reboot.sh
#!/usr/bin/env bash

echo -e "\033[34m--------------------wsgi process--------------------\033[0m"

ps -ef|grep nb_uwsgi.ini | grep -v grep

sleep 0.5

echo -e '\n--------------------going to close--------------------'

ps -ef |grep nb_uwsgi.ini | grep -v grep | awk '{print $2}' | xargs kill -9

sleep 0.5

echo -e '\n----------check if the kill action is correct----------'

/envs/nb/bin/uwsgi  --ini nb_uwsgi.ini &  >/dev/null

echo -e '\n\033[42;1m----------------------started...----------------------\033[0m'
sleep 1

ps -ef |grep nb_uwsgi.ini | grep -v grep
chmod 755 reboot.sh
./reboot.sh
stop.sh
#!/usr/bin/env bash

echo -e "\033[34m--------------------wsgi process--------------------\033[0m"

ps -ef |grep nb_uwsgi.ini | grep -v grep

sleep 0.5

echo -e '\n--------------------going to close--------------------'

ps -ef |grep nb_uwsgi.ini | grep -v grep | awk '{print $2}' | xargs kill -9

sleep 0.5

赋予可执行权限

chmod 755 reboot.sh
chmod 755 stop.sh

相关推荐

  1. Linux配置uwsgi环境

    2024-06-10 06:32:01       6 阅读
  2. flask+uwsgi+nginx+cerbot配置

    2024-06-10 06:32:01       8 阅读
  3. linux centos7 django uwsgi 部署

    2024-06-10 06:32:01       30 阅读
  4. linux配置大数据环境

    2024-06-10 06:32:01       15 阅读
  5. Rocky Linux 基本环境配置

    2024-06-10 06:32:01       9 阅读
  6. Linux环境配置ElasticSearch

    2024-06-10 06:32:01       5 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-10 06:32:01       8 阅读
  2. 【Python教程】压缩PDF文件大小

    2024-06-10 06:32:01       9 阅读
  3. 通过文章id递归查询所有评论(xml)

    2024-06-10 06:32:01       10 阅读

热门阅读

  1. Android防抖

    2024-06-10 06:32:01       7 阅读
  2. 高通Android 12/13添加/移除不被清理后台应用

    2024-06-10 06:32:01       6 阅读
  3. Docker面试整理-Docker Swarm与Kubernetes有什么区别?

    2024-06-10 06:32:01       6 阅读
  4. EF Core Model-First

    2024-06-10 06:32:01       6 阅读
  5. SOA的设计模式_1.服务注册表模式

    2024-06-10 06:32:01       5 阅读
  6. 209. 长度最小的子数组

    2024-06-10 06:32:01       6 阅读
  7. 主从式光伏并网发电系统体系结构

    2024-06-10 06:32:01       6 阅读