Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何修复基本flask应用程序,使其部署在heroku上_Flask_Heroku_Gunicorn - Fatal编程技术网

如何修复基本flask应用程序,使其部署在heroku上

如何修复基本flask应用程序,使其部署在heroku上,flask,heroku,gunicorn,Flask,Heroku,Gunicorn,我有一个基本的flask应用程序,不知道为什么它不会部署,并告诉我这个错误: 2021-05-08T22:58:28.799165+00:00 app[web.1]: Failed to find application object 'app' in 'application' 2021-05-08T22:53:27.203422+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET pa

我有一个基本的flask应用程序,不知道为什么它不会部署,并告诉我这个错误:

2021-05-08T22:58:28.799165+00:00 app[web.1]: Failed to find application object 'app' in 'application'
2021-05-08T22:53:27.203422+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=morning-badlands-59447.herokuapp.com request_id=bef13fba-bbfa-46ce-8eb8-cce75d2159fb fwd="104.0.129.162" dyno= connect= service= status=503 bytes= protocol=https
基本应用程序如下application.py:

from flask import Flask
application = Flask(__name__)


@application.route('/', methods=['GET'])
def index():
    return "<h1>hello world</h1>"


if __name__ == "__main__":
    application.run()


我希望将文件名保留为
application.py
,将Flask实例保留为
application
。谢谢大家!

您是否尝试将Procfile更改为
web:gunicorn应用程序:应用程序
web: gunicorn application:app