惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
U
Unit 42
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
F
Full Disclosure
月光博客
月光博客
Engineering at Meta
Engineering at Meta
博客园_首页
The Register - Security
The Register - Security
G
Google Developers Blog
The Cloudflare Blog
博客园 - Franky
K
Kaspersky official blog
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
NISL@THU
NISL@THU
AI
AI
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Vercel News
Vercel News
T
Tor Project blog
P
Privacy International News Feed
D
Docker
I
Intezer
L
LangChain Blog
P
Proofpoint News Feed
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
博客园 - 聂微东
AWS News Blog
AWS News Blog
Martin Fowler
Martin Fowler
P
Privacy & Cybersecurity Law Blog
V
V2EX
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
The Hacker News
The Hacker News
T
Tenable Blog
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog

博客园 - vsignsoft

CentOS7 安装 mysql-8.0.25-el7-x86_64.tar.gz Apache Doris 编译 Tensorflow 模型保存与调用 制作 macOS Mojave 映像文件 编程实现文件重定向 openssh 免用户名/密码/服务器地址,登录远程服务器 FreeSWITCH 增加模块 mod_ilbc 解析 iOS crash 文件 私有地址与公网地址的转换 Supervisor 自动管理进程 安装 Flask macOS 上创建 Windows 兼容的 iso镜像文件 公式 X/N = int(H/N) * 65536 + [rem(H/N) * 65536 + L]/N 的运用 在VirtualBox 里安装纯DOS,进行汇编编程实践 Xcode 6、7 打包 苹果笔记本电脑,开不了机经验记录 CST时间转换成 yyyy-MM-dd格式 git 常规使用小结 XCode6 开发本地化应用
使用 uWSGI 部署 Flask web 应用
vsignsoft · 2018-07-12 · via 博客园 - vsignsoft

1、安装 uwsgi

开启 python 虚拟环境(假设虚拟环境目录叫 venv),安装 uwsgi

source venv/bin/activate
pip install uwsgi
若出现错误:
plugins/python/uwsgi_python.h:2:20: 致命错误:Python.h:没有那个文件或目

原因是:系统缺少 python-dev
安装 python-dev:
sudo yum install gcc python-devel
然后再安装 uwsgi:
pip install uwsgi

2、配置 uwsgi

在工程目录,创建文件 uwsgi.ini

目录结构类似:.../my_project/uwsgi.ini

配置 uwsgi.ini 示例

[uwsgi]
http = 0.0.0.0:5007  # http 协议对客户端开发的端口号,客户端通过此端口访问 flask web 服务接口
pythonpath = .../my_project/my_app  # 应用目录,即python代码所在目录
wsgi-file = .../my_project/my_app/run_app.py # web 应用python主程序
callable = app  # 一般在主运行程序 run_app.py 里指定 app = Flask(__name__)
processes = 1
threads = 10
demonize = .../my_project/log/serve.log # 指定日志文件;如果使用 supervisors 需要注释掉,否则,supervisors 不能自动拉起 uwsgi 程序
home = .../my_project/venv # python 虚拟环境目录

3、启动 uwsgi

4、停止 uwsgi