Question

Configure a build command for a Python project without using the web UI

Posted October 7, 2020 231 views
DigitalOcean App Platform

I’d like to configure a build command for my Python application using configuration in my GitHub repository.

(I don’t want to use the UI for this because I want to create a template repository that other people can easily fork and alter for their own projects)

Is there a way of doing this directly using a file in the repo? I tried adding a release: block to my Procfile but that didn’t seem to work.

I know you can copy the App Spec into a .do/ directory in the repository but that’s no good for creating a template, because it bakes in details that are unique to your app (the GitHub repo and the app name).

I’d like an easy mechanism in my GitHub repository to say “run this build script” which will keep working if other people create copies of my repos and adapt them for their own projects.

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.

×
2 answers

Hi @swillison, you were actually on the right path with the Procfile! You can achieve this by setting a web command in the Procfile like so:

Procfile
web: python myapp.py

As a note, if you set a custom run command in your app spec (or through the web UI), it will override the one set in the Procfile.

Submit an Answer