Pushing to Heroku without overwriting the database

I have a rather more simple question but as I am new to Heroku and the whole git concept I am a bit confused. I honestly googled the problem, but I did not find a sufficient answer. Maybe you can help.

I just started to code a Flask App, based upon the Flaskr example, I pushed it on Heroku, therefore I used the Heroku Python Guide and I push changes using the following lines from my terminal (on Mac):

  • What is the best way to run REST API versions with Python Flask
  • Updating website through heroku flask application
  • Relocating virtual environment project from local to server (flask project), have to install dependencies again?
  • static HTML + Flask + Gunicorn works locally; breaks when pushed to heroku
  • Can't deploy generated Flask files using Git
  • Can't push on Heroku for Python Flask app
  • $ git add -A
    $ git commit -m "Pushing to Heroku"
    $ git push -f heroku
    

    Every time I perform a push with this lines my database on production is empty again. But I do not want this to happen all the time. What can I do? Maybe you guys know something about it.

  • Git push branch error after pull rebase
  • git-stash is moving my master branch
  • PHP Frameworks and Project Repositories
  • How do I get git to stop changing newlines in my files?
  • Git(hub): change branch?
  • Do I need to fork a repository multiple times to make multiple pull requests?
  • 2 Solutions collect form web for “Pushing to Heroku without overwriting the database”

    That’s happening because SQLite is a bad choice for Heroku. The following has been extracted from Heroku’s docs:

    SQLite runs in memory, and backs up its data store in files on disk. While this strategy works well for development, Heroku’s Cedar stack has an ephemeral filesystem. You can write to it, and you can read from it, but the contents will be cleared periodically. If you were to use SQLite on Heroku, you would lose your entire database at least once every 24 hours.

    Even if Heroku’s disks were persistent running SQLite would still not be a good fit. Since SQLite does not run as a service, each dyno would run a separate running copy. Each of these copies need their own disk backed store. This would mean that each dyno powering your app would have a different set of data since the disks are not synchronized.

    Instead of using SQLite on Heroku you can configure your app to run on Postgres.

    Just modify init_db function to check if entries table already exists: if it does, then don’t load schema.sql

    Git Baby is a git and github fan, let's start git clone.