Skip to main content
 首页 » 编程设计

python之在 Heroku 上提供来自 gunicorn 的 Bottle 应用程序

2024年11月01日10bhlsheji

简介

web: python server.py 

服务器.py

from os import environ 
from bottle import app, route, run, static_file 
 
@route('/') 
def root(): 
    return "Hello world!" 
 
if __name__ == '__main__': 
    run(server='gunicorn', host='0.0.0.0', port=int(environ.get("PORT", 5000))) 

需求.txt

gunicorn 
psycopg2 
git+https://github.com/defnull/bottle#egg=bottle 

日志文件的相关部分(在 git push 之后)

heroku[router]: at=error code=H14 desc="No web processes running"

请您参考如下方法:

首先:您确定这些是所有必要的要求吗?

如果是,您确定您分配了测功机吗? heroku ps 的结果是什么? H14 被列为通常是由于没有设置运行您的应用程序的测功机引起的。

您可以将它设置为使用一个带有 heroku ps:scale web=1 的 web dyno。