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.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With