使用Gunicorn的Bottle
from bottle import route, run
@route('/')
def index():
return 'Hello!'
run(server='gunicorn', host='0.0.0.0', port=8080)
from bottle import route, default_app
@route('/')
def index():
return 'Hello!'
app = default_app()
运行Bottle脚本时,这两种方式有什么区别呢?
第一种方式是用命令python app.py来启动你的应用。
第二种方式是用命令gunicorn app:app --bind='0.0.0.0:8080'来启动。