Before you can run the code, you will need a few things:

  • Django 0.96, and dependencies (specifically, at least one of the database interfaces; also, optionally, any of the various Web server setups that Django can connect to)
  • Python 2.4 or newer; 2.5 is recommended
  • The Python Imaging Library (Ubuntu: python-imaging)
  • The Python DNS library (Ubuntu: python-dns?)
  • Python SetupTools? (to install iCalendar and python-memcached, included in the repository) (Ubuntu: python-setuptools)
  • "cron" or an equivalent, to periodically run automated background tasks
  • LaTeX and the ImageMagick? command-line tools are needed for some features
  • Twill (the Python-based automation package) is needed for the (Ubuntu: python-twill)
  • memcached, if you want to use memcached-based caching (recommended) (Ubuntu: memcached)
  • Access to an SMTP server, for e-mail notifications

When we install this site on an Ubuntu Linux system, we install the following packages: python-django python-imaging python-flup python-setuptools python-psycopg python-dns python-twill texlive dvipng imagemagick memcached libmemcache0 postgresql-8.3 lighttpd

Note that there is a django-HEAD-transition branch of the code that takes advantage of Django 1.0pre.

You will also need the following libraries, which can be found in the "esp/3rdparty" directory:

  • iCalendar
  • python-memcached, if you want to use memcached-based caching (recommended)

Make sure to install these along with the ESP website's other dependencies, prior to trying to set up the website itself. To install them, first un-tar them into a temporary directory; then run "./setup.py install" as root (or an appropriate administrative user) from each package.

The procedure for installing the ESP Website is very similar to that of installing any other Django application; follow the instructions at http://www.djangoproject.com/documentation/install/.

Most of our PostgreSQL-specific code is stored in "esp/datatree/sql/datatree.postgresql.sql". Patches are welcome!

Once you have Django (and plpgsql) installed, create a file "esp/database_settings.py" (alongside, and imported by, "settings.py"). This file should contain three lines:

DATABASE_USER = '[database username]'
DATABASE_PASSWORD = '[database password]'
SECRET_KEY = '[long random string that's used as a password "salt", to add password security: Without the key, you can't even check passwords]'

You will probably want to update the Django settings in settings.py as well. See the Django documentation for details.

Once you've done this, run "./manage.py syncdb" inside the Django checkout to create the initial database.

After you've installed the site, make sure your webserver is set up as follows (the built-in Django development server, executed with "./manage.py runserver [hostname]:[port]", is already configured properly):

  • The ESP site is served at "http://[your server]/" (not out of a subdirectory)
  • "public/media/" is served at "http://[your server]/media/"
  • The Django Admin media (stored in "django/contrib/admin/media/" inside your system's Django install) is served at "http://[your server]/media/admin/"
  • Make sure your Web-server process can write to "public/media/latex/", "public/media/latex_media/", "public/media/subsection_images/", and "public/media/uploaded/", as well as "/tmp/".

We're currently in the process of simplifying our periodic-scheduling tasks using the django-command-extensions package (http://code.google.com/p/django-command-extensions/). For now, there are two scripts that have to be added to cron (or your periodic scheduler of choice):

  • "dbmail_cron.py" -- Our mass-emailing widgets don't actually send mail immediately; they create a database record that requests that the e-mail be sent. "dbmail_cron.py" actually sends these e-mails, with appropriate delays to limit the tendency of remote servers tending to mark us as spammers.
  • A script to periodically delete expired sessions from the "sessions" table. Such a script ships with django-command-extensions; we recommend that you simply install and use it.

After that: You should be done! When you ran "syncdb", you should have been prompted to create an administrative user; you can use that user account to log into the website and start creating content and programs.