[英]Deploy a python flask app with heroku database to heroku
I was able to launch my flask app when it wasn't using the database yet.当我的 flask 应用程序尚未使用数据库时,我能够启动它。 How do I set-up the database in heroku.如何在 heroku 中设置数据库。 I always run export DATABASE_URL=<URI>
in the terminal whenever I run my flask app.每当我运行 flask 应用程序时,我总是在终端中运行export DATABASE_URL=<URI>
。 I tried to follow tutorials online but nothing works so far.我尝试在线学习教程,但到目前为止没有任何效果。
This is my directory这是我的目录
This is my Procfile:这是我的 Procfile:
web: gunicorn wsgi:app
heroku ps:scale web
This is my requirements.txt:这是我的 requirements.txt:
click==7.1.2
Flask==1.1.2
gunicorn==19.10.0
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
Werkzeug==1.0.1
This is my wsgi.py when I placed my flask app inside the flask_qa folder:这是我将 flask 应用程序放在 flask_qa 文件夹中时的 wsgi.py:
from flask_qa import create_app
app = create_app()
This is the heroku log:这是 heroku 日志:
Maybe you need to set the app config using也许您需要使用
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgres://(you get the restof uri in heroku)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] =False
db = SQLAlchemy(app)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.