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

Posted November 16, 2020 671 views
DigitalOcean App Platform

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?


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.

Submit an Answer
1 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!