jotenbe
By:
jotenbe

Try to run python manage.py in a Dokku/Docker Container

May 12, 2015 995 views
Dokku Django

Hello,

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 manage.py migrate' (or collectstatic, createsuperuser - it doesn't matter)

Every time I get this error:

/exec: row 10: python manage.py 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

1 Answer

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:

Django==1.9.8

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:

  • django-admin.py startproject --template=https://github.com/heroku/heroku-django-template/archive/master.zip --name=Procfile myproject
Have another answer? Share your knowledge.