Try to run python in a Dokku/Docker Container


I have a problem with Dokku and Django.

I created a DigitalOcean Dokku Droplet and pushed my Django App. The Application works fine, but there is a problem if I try to run a Django Command.

dokku run APP 'python migrate' (or collectstatic, createsuperuser - it doesn’t matter)

Every time I get this error:

/exec: row 10: python migrate: command not found

I have no idea why

Installed Plugins: 00_dokku-standard apps backup build-env checks common config docker-options dokku-apt dokku-supervisord domains git nginx-vhosts persistent-storage ps shell

Any ideas?

Thanks and Greetings Jonas


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.

The migrate sub-command was not introduced to Django until the 1.7 release. The first thing I would do is to make sure the correct version of Django is being installed in your container. The best way to do this is to specify a specific version in your requirements.txt file. E.g:


You’ll also want to make sure that your project structure is correct. As Dokku uses a lot of best practices from Heroku, the easiest way to do that might be to use Heroku’s Django Starter Template for a new projects.

You can start a new Django project using that template, by running: startproject --template= --name=Procfile myproject