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

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

博客园 - 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