簡體   English   中英

與Gunicorn的瓶子

[英]Bottle with Gunicorn

像這樣運行瓶子腳本有什么區別

from bottle import route, run

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

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

使用命令python app.py和this

from bottle import route, default_app

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

app = default_app()

使用命令gunicorn app:app --bind ='0.0.0.0:8080'

基本上沒什么。

從該瓶的源代碼GunicornServer 在這里你可以看到一個基本的應用程序被加載並與您的參數運行。 根據gunicorn源代碼, gunicorn命令根據setup.py調用的gunicorn 唯一的區別是使用了WSGIApplication類。 嗯, default_proc_name是'app:app'或'gunicorn',具體取決於你調用的那個。 在這個簡單的情況下,其他參數都不重要。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM