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.
Checkout
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
Structure
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
Dependencies
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_ENGINE = 'sqlite3'
DATABASE_NAME = 'dev.db'
DATABASE_USER = ''
DATABASE_PASSWORD = ''
DATABASE_HOST = ''
DATABASE_PORT = ''
When you have these settings set, simply run the following to create your database and install the fixtures.
python manage.py syncdb
Django-Photologue
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.
mod_wsgi
For Apache and mod_wsgi deployments hers is a sample virtual to get you up and running.
<VirtualHost 208.00.00.000:80
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
</VirtualHost>
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__),
'django-hotclub')))
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.
mod_python
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.
<VirtualHost 208.00.00.000:80
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"
</Location>
Alias /media/ /src/django-trunk/django/contrib/admin/media/
<Location /media/>
SetHandler none
</Location>
Alias /site_media/ /path/to/your/django-hotclub/pinax/site_media/
<location /site_media/>
SetHandler none
</Location>
</VirtualHost>
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.









On Friday, Sep 19
It's probably worthy pointing that that Python 2.5 is also a prerequisite for using Pinax.
On Friday, Sep 19
David,
That is true now, but we will be fixing Pinax and forcing all reusable apps to be 100% compatible with Python 2.3. The idea is that Pinax and all reusable applications should be compatible with what Django 1.0 has compatibility with.
On Friday, Sep 19
Brian,
Excellent! That sounds good. Perhaps I should contribute the workarounds I found when trying to get it working on 2.4 ;)
On Friday, Sep 19
Awesome writeup. I think a common misconception is that Pinax has all these great features, but is hard to set up. You certainly showed that it's not hard to set up at all!
On Friday, Sep 19
@brosner - thanks for clarifying that. I wasn't 100% sure which is why I didn't include it in the write-up.
@david - Your patches are always welcome!!
@eric - thanks bro! much appreciated. It really isn't hard but while the documentation is being worked on, I figured it doesn't hurt to provide some instructions.
On Monday, Sep 29
You can also deploy using the WSGI server from the deploy folder.
Just start it with manage.py.
You'd need to Proxy the WSGI server through Nginx like so: http://vizualbod.com/articles/nginx-fastcgiwsgi-django-deployment