Syncing local and elastic Beanstalk databases?

I recently deployed a Django web application on Elastic Beanstalk. I configured it to access the Django admin interface online and add content to the site.

Now the site is still under construction - I will chop and modify and make tweaks, etc. Unfortunately, every time I deploy my application from the local version, the database (SQLite) is overwritten and the content that I added the online version is deleted.

Is there a way to “pull” the database (and only the database) from the website? Or can I tell the deploy command to ignore the database?

Thanks guys.

+5
source share
1 answer

As mentioned in a few comments, since (maybe) your SQLite database is a file in the directory of your project, it is replaced / deleted every time you deploy the application, so you lose all data between deployments.

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

Answering your question in more detail and assuming that you want to leave your setup as it is (at least when you asked the question), I see two ways to save your database between deployments. One of them accesses the ssh instance and retrieves the database file, the other exports your data using the dumpdata command from django and then load it using loaddata .

0
source

All Articles