1
I have a small application written in flask and I am having problems with the database when trying to deploy in Heroku and after searching for two days I did not find any solution that suits me.
In short, this is the code of my app:
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:1234@localhost/jperfil'
db = SQLAlchemy(app)
app.secret_key = '123456789'
#aqui vão os registros de algumas blueprints e imports de classes
db.create_all()
I can imagine that this is not how you configure a bank to deploy, because these are the settings of the local bank, but how to configure so that Heroku understands the settings and create my bank automatically?
I removed the <code>db.create_all()</code>, but still the error.
– Italo Carvalho
I don’t know what the deployment system is like in Heroku but in GCI (Google Cloud Infrastructure) a deploy file is used that what it does is create the database, so in Heroku you must have to create the database manually.
– Gil Sousa
You can use an environment variable to avoid having to edit the URI database before deploying.
– Gil Sousa