Setting up Django at Slicehost

There are a lot of nice posts out there on setting up django, and some on setting things up on slicehost, but there were some caveats and these are my notes.First off, so far I highly recommend slicehost for the following reasons:

  • they’re cheap
  • they’re very explicit about what you’re getting in terms of hardware and performance
  • they have a very slick integrated backup solution for $5 more per month.  You can setup daily recurring backups and weeklies, and you can take a snapshot at any time.  This ROCKs.  Restore from a backup with a single click.
  • Their control panel is slick, custom, and works very well.
  • They offer a variety of distros.  I’ve got both a debian and an ubuntu flavor running.

Slicehost won’t be good for you if you want one of those “one-click” type setups for Ruby on Rails or Django.  Then again, I’ve tried Webfaction, MediaTemple, and read about a lot more and I have to say they’re more trouble then they’re worth in my opinion.I got my slice, did some chores to get things like rsync installed, etc., and checked out the latest django trunk.I had used the following Apache config:

NameVirtualHost *        ServerName                SetHandler python-program                PythonHandler django.core.handlers.modpython                PythonOption django.root /PROJECTNAME                PythonDebug On                PythonPath "['/home/USER/'] + ['/home/USER/PROJECTNAME/'] + sys.path"                SetEnv DJANGO_SETTINGS_MODULE PROJECTNAME.settings

Most of the confusion surrounded the project name option with the PythonOption directive and the PythonPath variables. These could definitely be more clear in the stock django setup documentation.Another thing that irritated me is specifying the root url in the file. Here’s what worked, finally. Note that I was probably complicating matters by not restarting apache after everything I tried. Django will look like it’s “refreshed” without an Apache restart at times, but just restart after ANY code change.


Additional Notes:

  • After I got things more or less working, I still couldn’t use the admin area.  I had to make sure that Apache could write to both the directory that contained the database, and the parent database.  I’m using SQLite 3 and was getting the error:  django works admin can’t open database
  • The admin area CSS needs to be symlinked and added in the  I used the following: ln -s /PATH/TO/django-trunk/django/contrib/admin/media /home/USER/PRJECT/media

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s