简体   繁体   中英

Bottle with Gunicorn

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'

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM