Gunicorn

作者: 奥特曼255 | 来源:发表于2018-05-27 17:02 被阅读0次

    使用 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

    相关文章

      网友评论

          本文标题:Gunicorn

          本文链接:https://www.haomeiwen.com/subject/dnsbjftx.html