Categories
Python

Fixing DreamHost’s Django Deployment Script

I recently created a trivial site locally with Django that I wanted to deploy on my DreamHost shared server.  DreamHost has made this process pretty painless by creating an easy-to-follow guide that can be found here.  The only problem is that it doesn’t work.  After entering in my project name and database info, i got the error message:

Creating project framework…  oops, django-admin failed to run!

With nothing to lose (and not wanting to figure out how to get Passenger set up on my own), I dove into their django-setup.py script.  As it turns out, the problem is on line 126.

if os.spawnl(os.P_WAIT, "/usr/bin/django-admin.py", "django-admin.py", "startproject", projname) != 0:

Apparently on DreamHost, django-admin.py has dropped the extension. So if you replace line 126 with the following, everything works great.

if os.spawnl(os.P_WAIT, "/usr/bin/django-admin", "django-admin", "startproject", projname) != 0: