ubuntu服务器中运行flask

ubuntu服务器中运行flask

使用Gunicorn:

pip install gunicorn
gunicorn -t 180 -w 4 -b 0.0.0.0:8080 app:app

-t 180  设定单次请求服务器的最长响应时间为180s,否则会重启线程
-w 4  启动4个工作线程
-b    绑定的IP:port
app:app  启动app.py中的app对象应用

封装app.py:

新建wigs.py:

from app import app

if __name__ == "__main__":
    app.run()

gunicorn -t 180 -w 4 -b 0.0.0.0:8080 wsgi:app

参考链接:https://www.cnblogs.com/AdamTang/p/15603861.html

你可能感兴趣的:(Python,flask,服务器,ubuntu)