在heroku上部署Flask应用程序时出错:无法在'app'中找到属性'app'

问题描述 投票:0回答:1

我正在尝试在heroku上部署我的非常简单的Flask应用程序,但是当我尝试访问Heroku应用程序时,它给了我这个错误:An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.我从终端检查了日志,并说:未能找到属性'app 'in'app'

代码

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return "VatsalayKhobragade.me"

项目结构

*

Procifle

web: gunicorn app:app

Requirements.txt

click==7.1.2
Flask==1.1.2
gunicorn==20.0.4
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
Werkzeug==1.0.1

请对此提供帮助。我在这里做错了什么??

flask heroku web-deployment
1个回答
0
投票

可能可以通过procfile解决:

web: gunicorn app.app:app


尽管为清楚起见,您可能希望将顶级app文件夹重命名为其他名称,然后使用:

web: gunicorn something.app:app

或创建具有内容的something/__init__.py文件:

from .app import app

然后只需要一个带有:的procfile]:>

web: gunicorn something:app

© www.soinside.com 2019 - 2024. All rights reserved.