Andrew McNabb

Smug: Simple Setup

Smug is built in the Django framework. If you aren't familiar with Django, I highly recommend that you familiarize yourself with the Django documentation. I'll repeat some of the steps here, but it's really best if you're already familiar with the process.

Smug is a Django app and will need to be installed somewhere on your PYTHONPATH. If you don't know what this means, create a "python" directory in your home directory. This python directory will contain both Smug and your Django project module.

Check out Smug

Check out Smug to your PYTHONPATH directory. To do this, go to the python directory and run:

git clone git://mcnabbs.org/smug.git

This will create a directory called Smug that has all of the Smug source code.

Create Smug Project

Check out the sample Smug Django project to your PYTHONPATH directory. To do this, go to the python directory and run:

git clone git://mcnabbs.org/django_smug.git

Create a Smug Repository

A sample Smug repository is available. If you will be serving your site with Apache, you should check it out by running the following:

mkdir /path/to/repository.git
cd /path/to/repository.git
git --bare init --shared=group
chgrp -R shared_group_name .
git fetch git://mcnabbs.org/smug_html.git master:master

If you will just be using the Django development server (it's a local site only, or you're just testing), then you can instead run:

git clone git://mcnabbs.org/smug_html.git

Django Development Server

If you're using the Django development server, you must make sure that your PYTHONPATH is set appropriately before proceeding further. Otherwise, Python wouldn't be able to find either "mysite" or "smug".

If you're using the Django development server, just add "export PYTHONPATH=$HOME/python" to your bashrc (and load your changes). You can then cd to "mysite", run "python manage.py runserver", and go to "http://localhost:8000/" in a web browser. Note that the Django documentation has a lot of information about setting this up.

Django in Apache

If you're using Apache, you will need to set Python as the handler. you might have something like the following in httpd.conf (and if you want authenticated sessions to go over SSL, as I recommend, it should also go in ssl.conf).

<Location "/you/pick/the/location/">
    SetHandler python-program
    PythonPath "['/path/to/pythonpath/directory'] + sys.path"
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    #PythonDebug On
</Location>

In this example, it really is important to have both "mysite" and "smug" in "/path/to/pythonpath/directory". Otherwise, Python won't know where to find these modules.

Powered by Smug