我正在Heroku上使用FLASK部署Python API。已成功部署,但在打开网页时出现错误。
main.py ->
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/',methods=['GET'])
def validation_page():
name = str(request.args['name'])
return name
if __name__ == '__main__':
app.run(debug=True)Procfile ->
web: gunicorn app:main使用此URL打开网页-> https://test-app-validate.herokuapp.com/?name=deepak
日志->
heroku logs --tail
2021-02-20T09:27:04.943561+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET
path="/?name=deepak" host=test-app-validate.herokuapp.com request_id=38dc080a-87a3-4b4f-8d28-
ba891041b141 fwd="183.83.42.60" dyno= connect= service= status=503 bytes= protocol=https
2021-02-20T09:27:05.572264+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET
path="/favicon.ico" host=test-app-validate.herokuapp.com request_id=90d6e83d-6488-44ec-a7d2-
3a01188f3fdc fwd="183.83.42.60" dyno= connect= service= status=503 bytes= protocol=https已尝试:-
heroku ps:scale web=1请告诉我我哪里错了。
发布于 2021-02-25 02:11:53
format为<module>:<callable>。在您的示例中,您将Gunicorn指向模块app和可调用的main,这是相反的-您有一个名为main的模块和一个名为app的可调用的模块。
您的配置文件应该显示为web: gunicorn main:app。
https://stackoverflow.com/questions/66289984
复制相似问题