How to run management commands when deploying Django apps via the API?

Hi there,

When launching a Django app using the API of Digital Ocean App Platform, how do I programmatically run collectstatic and migrate after the deployment has finished?

thx! Gijs


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Accepted Answer

👋 @gijsnijholt

There are a couple options for running command after your app has been deployed:

  1. Manually go to the console tab in App Platform and run your commands on the same container as your service is running on
  2. Run a post deploy job: job documentation

Hope this helps!