问题描述
我刚开始使用Bottle。我在GitHub上找到了一个示例应用程序。该示例只有一个server.py文件,如下所示
import bottle
APP = bottle.Bottle()
@APP.get('/')
def index():
return '<p>Hello</p>'
if __name__ == '__main__':
bottle.run(application=APP)
Requirements.txt文件具有
bottle
gunicorn
作为依赖项。我正在使用Python 3.7.2。运行pip install -r requirements.txt后,我运行了python server.py。服务器启动时在端口8080上没有错误
我尝试如下使用gunicorn运行服务器
gunicorn -w 2 -b 0.0.0.0:8080 server:app
这将导致错误,并且服务器无法启动。 gunicorn命令有什么问题?
解决方法
gunicorn -w 2 -b 0.0.0.0:8080服务器:APP
感谢克劳斯D指出