Devigner blog about development and design

Pinax Setup and Deployment

For the past four or five months I’ve been helping out and contributing to the Pinax project which is gaining popularity and buzz very quickly. If you’re not up to speed on what Pinax is, the best and most amusing way is to watch the video of James Tauber’s talk at Djangocon or simply dive in and get your social network up and running.

After the launch of Cloud27 and Djangocon, there has been much more activity surrounding Pinax and a few questions about deployment. While the documentation is being worked on, I figured I would write up some general principals on the deployment of your project.


Obviously, you need something to work with so go get the source or using subversion…

svn checkout http://django-hotclub.googlecode.com/svn/trunk/ django-hotclub


First glance at your directory structure will reveal the following:

  • pinax/ contains a django project and templates
  • external_apps/ contains external re-usable apps brought in via svn:externals
  • local_apps/ contains re-usable apps that aren’t yet externalized
  • core_apps/ contains non re-usable apps specific to pinax site
  • external_libs/ contains external libraries


The only real dependency is python imaging library which is required for Photologue and its image uploader and resizing. Other dependencies that may be required for your particular server are located in the external_libs directory if you find you need them. It’s nice that you don’t have to run around google trying to find these packages, (with the exception of PIL) they are all provided for you.

Settings and Customization

Typically, the only thing you really need to change are the database connections and type depending on your preference. Create a localsettings.py file in the pinax directory and add the following (if you do not want to use the default sqlite3 setup).

# 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = 'dev.db'

When you have these settings set, simply run the following to create your database and install the fixtures.

python manage.py syncdb


Pinax has photo sharing capabilities and uses some of the functionality provided by django-photologue. As stated in the dependencies, you will need to have PIL installed on your server to take advantage of these features.


For Apache and mod_wsgi deployments hers is a sample virtual to get you up and running.

    ServerName somedomain.com
    ServerAlias www.somedomain.com
    DocumentRoot /home/somedomain/public_html
    WSGIScriptAlias / /path/to/your/django.wsgi
    WSGIProcessGroup uniquename
    WSGIDaemonProcess uniquename user=apacheuser group=apachegroup threads=25

Sample django.wsgi file:

import sys
sys.stdout = sys.stderr
import os
from os.path import abspath, dirname, join
from site import addsitedir
path = addsitedir(abspath(join(dirname(__file__), 
    'django-hotclub', 'external_libs')), set())
if path: sys.path = list(path) + sys.path

sys.path.insert(0, abspath(join(dirname(__file__), 
    'django-hotclub', 'external_apps')))
sys.path.insert(0, abspath(join(dirname(__file__), 
    'django-hotclub', 'local_apps')))
sys.path.insert(0, abspath(join(dirname(__file__), 
    'django-hotclub', 'core_apps')))
sys.path.insert(0, abspath(join(dirname(__file__), 

from django.core.handlers.wsgi import WSGIHandler

os.environ['DJANGO_SETTINGS_MODULE'] = 'pinax.settings'

application = WSGIHandler()

Here is a good overview on using mod_wsgi with django if you want more information.


For Apache and mod_python deployments here is a sample virtual setup to get you going. The following makes the assumption that you have installed the dependencies you might need.

    ServerName somedomain.com
    ServerAlias www.somedomain.com
    DocumentRoot /home/somedomain/public_html
    <Location />
        SetHandler python-program
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE pinax.settings
        SetEnv PYTHON_EGG_CACHE "/path/to/your/python-eggs"
        PythonPath "['/path/to/your/django-hotclub'] + sys.path"
    Alias /media/ /src/django-trunk/django/contrib/admin/media/
    <Location /media/>
        SetHandler none
    Alias /site_media/ /path/to/your/django-hotclub/pinax/site_media/
    <location /site_media/>
        SetHandler none

Additional Resources

If you have any additional question or need help, the quickest way to get it is to join us in the #pinax irc channel on freenode.

[UPDATE] Eric Holscher has also posted a nice Getting Started Guide worth checking out.