Gunicorn

2018-05-27  本文已影响0人  奥特曼255

使用 gunicorn 启动程序

# -b 用来绑定地址
# main 是 main.py
# app 是 main 中的 Flask 实例变量名
gunicorn -b 0.0.0.0:8000 main:app

# 增加工作进程, 使用 --workders 参数, 4 是工作进程数
gunicorn --workers 4 main:app -b 0.0.0.0:8000

# 让 gunicorn 在后台持续运行
(gunicorn main:app -b 0.0.0.0:8080 &)
nohup gunicorn -b '0.0.0.0:80' wsgi:app &

其他实际应用的例子

gunicorn -b '0.0.0.0:80' 文件名:app实例
gunicorn -b '0.0.0.0:80' wsgi:application
gunicorn -b '0.0.0.0:80' redischat:app
gunicorn -w 4 -b 0.0.0.0:80 wsgi:app
gunicorn wsgi --worker-class=gevent -t 4 -b 0.0.0.0:8000
gunicorn --worker-class eventlet -w 1 wsgi

上一篇下一篇

猜你喜欢

热点阅读