excess.org

Ian Ward

Software
CKAN contributor/tech lead
Urwid author
PyRF contributor
Speedometer author

Presentations
Contributing to Open Source
IASA E-Summit, 2014-05-16
Urwid Applications
2012-11-14
Urwid Intro
2012-01-22
Unfortunate Python
2011-12-19
Django 1.1
2009-05-16

Writing
Moving to Python 3
2011-02-17
Article Tags

Home

Ian Ward's email:
first name at this domain

wardi on OFTC, freenode and github

Locations of visitors to this page

OCLUG Django Site

Django Overview Slide
Posted on 2007-06-13, last modified 2007-06-22.

On May 31 I gave a tutorial on the new site code for the Ottawa Canada Linux Users Group.

The new site is based on Django. It implements the logic for displaying upcoming and past events, tracking speakers, locations and images. It can also display announcements as part of the front page.

The slides from my tutorial and the source code at various stages are attached below.

Slides

Download all slides as PNG files (368K) / Download slide Inkscape SVG source file (6K)

Source Code

Download the OCLUG Django site source code stages 0-5 (186K)

I strongly recommend following through the Django Tutorial before diving in to this source code.

Installation

First you will need to install Apache 2, mod_python, python-markdown and a recent version of Django.

Next you will need to edit the settings.py files and change the database configuration to something that works on your machine. The simplest is to use:

DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/some/directory/where/apache-can-write/ocdj.db'

Also change all /home/ian/oclug references to the path where you installed the source. The admin symlink in docroot/media/ also needs to point to the contrib/admin/media/ directory in your Django installation. You need to make these changes in all the stage directories you plan on running.

Next, populate your database with some meeting information by running these commands (make sure its stage5/settings.py has updated database information):

cd stage5
./manage.py syncdb

If you have configured all the settings.py files point to the same database then they will all use the data that has been loaded, even if some of the models don't exist in the earlier stages.

Finally, you need to configure Apache to serve the stage you want to test. You may use a VirtualHost like the following:

<VirtualHost *>
    DocumentRoot /home/myself/path/to/ocdj/stage5/docroot
    <Location "/">
        SetHandler python-program
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE settings
        PythonPath "['/home/myself/path/to/ocdj/stage5']+sys.path"
        PythonDebug On
    </Location>
    <Location "/media/">
        SetHandler None
    </Location>
</VirtualHost>

Other Tools

During my talk I used Meld to show the differences between each stage.

Tags: Django OCLUG