My Django Buildout

For some reason, setting up Django with Apache has always been a challenge for me. I’ve been working with Plone buildouts, and wondered if Django might have a recipe to help me. There are currently two Django recipes that I was able to find, and one of them offers help setting up mod_python.

Svn link for Django buildout

Trac for Django buildout project

I pretty much followed the instructions at the trac link.  I got a copy of the project, and updated the project in the buildout.cfg file to my project name.  The buildout for the Django recipe itself was freezing up, so I also added a symlink to my Django installation in the top level folder.  (This is listed as django:django_location in the buildout.cfg file.)  Apache needs to be able to access a Django installation in order to interpret the site.  I got a django.core.modpython could not be found error before I figured out that this was an issue.

I want to be able to re-use this recipe, but keep the most up to date version of the recipes.  So, I stuck this top level information in my own svn, and added the original links in my svn:externals:

$ svn propedit svn:externals .

conf http://svnpub.yaco.es/djangobuildout/conf
docs http://svnpub.yaco.es/djangobuildout/docs

Buildout created my project for me, including a basic settings.py file.  The media and templates are set up in the project directory, and worked right away for me.

I used the mod_python cfg file to set up Apache.  This created a file that I was able to symlink to in my /etc/apache2/sites-enabled directory.  Instructions for that are at the trac link.  The issue I ran into was that I have a lot of public-facing Plone sites on this server, all running under a subdirectory on Apache.  I am by no means an Apache expert, and was unable to figure out how to do this.  However, I was able to set my site up under it’s own port.  I went into the configuration file, and changed the VirtualHost line to look like this: <VirtualHost *:8000>  I then added the line NameVirtualHost *:8000 on the line above it.  Restarted Apache, and I could browse to my site using port 8000, http://www.site.com:8000.

Advertisements

~ by Liz on September 23, 2008.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

 
%d bloggers like this: