Added Database Records Are Deleted After Restarting App (heroku/sqlalchemy)
So here's my problem: I created a heroku app that is working as expected, although when the app is restarted, all the new records in the database are deleted. The ones from my loca
Solution 1:
Two things - 1) you connect to your PostgreSQL instance using the configuration that Heroku provides in the environment. Simply use:
importosSQL_ALCHEMY_DATABASE_URI= os.environ['DATABASE_URL']
The environment variable DATABASE_URL
will be populated by Heroku, and have the connection information (host, username, password, database).
2) The Heroku filesystem is ephemeral, and does not persist between dyno restarts. That is why your sqlite
database disappears.
Post a Comment for "Added Database Records Are Deleted After Restarting App (heroku/sqlalchemy)"