# 一 使用uwsgi部署python的web项目
```python
一般在部署Django或者Flask时,我们为了利用多核优势,一般使用uwsgi部署,原理如下
如果我们设定uwsgi进程数为3,那么操作系统是开启3个进程来运行python的web程序
如果我们在web项目中使用全局变量,由于多进程间数据是隔离的,所以定义的全局变量,分别在3个进程中
```
# 二 测试
## 2.1 写一个flask程序(s1.py)
```python
from flask import Flask
import time
app = Flask(__name__)
count = 0
@app.route('/')
def hello_world():
global count
count+=1
return 'Hello World!'+str(count)
if __name__ == '__main__':
app.run(host='0.0.0.0')
```
## 2.2 编写uwsgi的配置文件 (uwsgi.ini)
```python
[uwsgi]
http = 0.0.0.0:5000
chdir = /root/
wsgi-file = /root/s1.py
processes =