What this is about
After learning how to build a Flex client and a Python server running on Google App Engine, I decided to try a pure-Web, pure-Python alternative. I chose Django, a first-class Web framework. I went through the tutorial and read the excellent book Practical Django Projects. The next step is building a website with some applications.
Fortunately, I found out about the Pinax project. It builds a website framework over Django and provides patterns for interoperable applications. I decided to learn how to leverage it so I can learn best practices and use some of its nice features like notifications.
I will do my learning in the open, as I did before, sharing my path and my discoveries. This is a journey from the eyes of a n00b that knows very little about Python, Django and Pinax.
I found out that this process helps me focus and structure my self-learning. I hope it may be useful to someone that follows the same path. And maybe someone more knowledgeable will correct one or two of the bloopers I make.
I started in a development environment that was already configured to run Django applications and had its fair share of tools, like a Subversion client and sendmail. You will have to refer to basic Django and Python material if you need to learn how to get to this point. Also, all my work is being done on Ubuntu 8.10, so you may need to adjust some commands if you use other environment.
Making a directory for Pinax:
$ mkdir ~/opt/django -p $ cd ~/opt/django
Downloading Pinax and associated applications and libraries:
$ svn checkout http://svn.pinaxproject.com/pinax/trunk/ pinax
I am using version 0.5.0rc1. Things might be different if you use a newer version.
Creating a sample project
Pinax comes with a sample project that can be used directly, but I will create an independent clone that I can change at will without getting in trouble with repository updates later.
$ cd pinax/projects/ $ svn export complete_project/ ~/Projects/exploring_pinax
Now we must edit settings.py to reflect the directory where we installed Pinax:
$ cd ~/Projects/exploring_pinax $ vi settings.py
Change PINAX_ROOT to the main Pinax directory. For instance:
... PINAX_ROOT = '/home/fernando/opt/django/pinax' ...
Also set ROOT_URLCONF using the name of the directory you exported the website project to:
... ROOT_URLCONF = 'exploring_pinax.urls' ...
After that, save settings.py.
If we want, we can also create a file for future local settings like database passwords. I won’t use it now, but it may be handy to have it already created:
$ touch local_settings.py
Now create the local sqlite3 database:
$ python manage.py syncdb
When asked, create a superuser (admin).
Starting the website
$ python manage.py runserver
Open http://127.0.0.1:8000/ in your browser. You should have a Pinax website running. Congratulations! Login with your superuser and explore at leisure.
Your feedback is most welcome.