By yrfriedman
Using the App platform for a Wagtail(django) project, I struggle to continuously deploy my database.
My project’s code is updated upon deployment. I can then enter the data from my server. Yet, the DB component isn’t updated.
My emote DB can run the project with either sqlite3 or postgres. While sqlite is simpler for local considerations, I switched to postgres for a continuous deployment.
I added a Db postgres component. But it doesn’t display the deployment modifications. Idem, after I run ‘python manage.py migrate’ command in my server console.
I found plenty of information but no script that is guaranteed to work and is up-to-date.
I’d highly appreciated if you can you advise on the best practice, a barebones example that I can follow step-by-step that would set me on my way.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey there!
It sounds like you may be storing your database content within the application and it is getting overwritten on each deploy. Adding a Postgres database as a component would allow it to be accessed by your application using the env variable DATABASE_URL. You would need to configure your application to use that variable to connect to the external database rather then sqlite running within the app. I would recommend you take a look at our Django tutorial on how to configure that connection within your app.
Hope it helps! Nate
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.