continuous deployment django database

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 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.

Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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