瓶子里的枪神[英] Bottle with Gunicorn

本文是小编为大家收集整理的关于瓶子里的枪神的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

像这样的运行瓶脚本有什么区别

from bottle import route, run

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

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

使用命令 python app.py 和此

from bottle import route, default_app

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

app = default_app()

使用命令 Gunicorn App:App -bind ='0.0.0.0:8080'

推荐答案

本质上什么都没有.

GunicornServer GunicornServer 在这里您可以看到基本应用程序已加载并随您的参数运行.摘自《枪源源代码根据setup.py所调用的gunicorn命令所调用的内容.唯一的区别是使用WSGIApplication类.好吧,default_proc_name是"应用程序:app"或" gunicorn",具体取决于您所调用的一个.在这种简单的情况下,其他参数都不重要.

本文地址:https://www.itbaoku.cn/post/1975365.html

问题描述

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.