【发布时间】:2016-01-21 16:20:25
【问题描述】:
我正在运行一个简单的bottle 应用程序,并将gunicorn 作为网络服务器,该应用程序运行良好。我的代码:
from bottle import route, run, template
@route('/hello/<name>')
def index(name):
return template('<b>Hello {{name}}</b>!', name=name)
bottle.run(server='gunicorn', workers="3")
问题
现在我想创建自己的gunicorn 配置文件 并将它与bottle 一起使用。我想为 gunicorn 工作者添加很多额外的功能(例如 SSL),使用配置文件是一个很好的方法。
我试过了:
bottle.run(server='gunicorn', config="settings.py.ini")
AND
bottle.run(server='gunicorn', -c="settings.py.ini")
我知道在 CLI 中可以将设置文件设置为额外选项,如下所示:
-c CONFIG, --config CONFIG
gunicorn --config="settings.py.ini"
有人知道在使用bottle gunicorn控制器时如何实现同样的功能吗?
【问题讨论】:
标签: python settings gunicorn bottle