Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syncing local and Elastic Beanstalk database?

I recently deployed a Django web app on Elastic Beanstalk. I have configured it so that I can access the Django admin interface online and add content to the online site.

Now, the site is still under development - I will be chopping and changing and making tweaks, etc. Unfortunately, every time I deploy my app from the local version, the database (SQLite) is overwritten and any content I added on the online version is deleted.

Is there a way to 'pull' the database (and the database alone) from the online site? Alternatively could I tell the 'deploy' command to ignore the database?

Thanks folks.

like image 891
Jack Parkinson Avatar asked Oct 31 '22 04:10

Jack Parkinson


1 Answers

As it already been said in several comments, since (probably) your SQLite database is a file in your project directory it is being replaced/deleted each time you deploy your application, that is why you lose all data between deploys.

For production instances (and specially for these PaaS services) you should use an external database (PostgreSQL, MySQL,etc.).

Answering your question more directly, and assuming you want to leave your setup as it is (at least when you asked the question), I see 2 ways you could save your DB between deployments. One is accessing by ssh to the instance and fetch the database file, the other is exporting you data using the dumpdata command from django and then load it using loaddata.

like image 99
dethos Avatar answered Nov 09 '22 23:11

dethos