Bottle with Gunicorn

北城以北 提交于 2019-12-10 17:40:29

问题


What is the difference between running bottle script like this

from bottle import route, run

@route('/')
def index():
    return 'Hello!'

run(server='gunicorn', host='0.0.0.0', port=8080)

with command python app.py and this

from bottle import route, default_app

@route('/')
def index():
    return 'Hello!'

app = default_app()

with command gunicorn app:app --bind='0.0.0.0:8080'


回答1:


Essentially nothing.

From the bottle source code for the GunicornServer here you can see that a basic application is loaded and run with your argument. From the gunicorn source code this is what is invoked by the gunicorn command according to setup.py. The only difference is the WSGIApplication class is used. Well, default_proc_name is either 'app:app' or 'gunicorn' depending on which one you invoked with. None of the other parameters matter in this simple case.



来源:https://stackoverflow.com/questions/26362532/bottle-with-gunicorn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!