« When Technology isn't the answer | Main | Iteration 4 Signed Off »

December 7, 2005

How to get started with the code

Formatted nicely from the HOWTO:

Running the server

Prerequisites:

Python 2.4
eGenix mx Base
Psycopg 1.x (or get the compiled windows binaries)
PostgreSQL

Use subversion to check out the source to a folder called "melt" (username: anonymous, blank password):

svn co https://svn.greenpeace.org/repositories/custard/production/trunk/melt melt

Create a database in PostgreSQL - use the included pgAdminIII tool or run:

createdb melt

Edit the melt/settings.py file to point to your database. Make sure the following settings are correct:

DATABASE_NAME
DATABASE_USER
DATABASE_PASSWORD
DATABASE_HOST
DATABASE_PORT

Now, you can use our build.py script to do almost everything you need! Run:

python build.py

This will show you all of the build targets that are available.

First, initialise the freshly created database:

python build.py recreateDB

Now, load the necessary data into the database, such as the list of countries:

python build.py loadReferenceData

Then, start up Django's development server:

python build.py runserver

You should now be able to see custard in action at http://localhost:9090 in your web browser. Enjoy!



Doing development

If you want to do development, there are a few more steps. First, you are going to need xmllint, which we use to validate all of our XHTML. You can find xmllint in the libxml2 package:

libxml2

Make sure you have the server running, and run:

python build.py runfulltests

This will run our unit, functional, and nonfunctional tests.


Running in production

Django's development server is great for development, with its autoreloading and quick responsiveness. But if you want to host the site for more than just you, you are going to want to use Apache + mod_python:

Prerequisites:

Apache 2.x
Mod Python 3.1.x


First, you need to configure Apache to serve the site through Django. See our melt.conf as an example:

melt.conf

Notice how the melt.conf does not use Django to serve the static files (CSS, images, etc.) because it would be too slow.

Finally, change the MEDIA_ROOT setting in the melt/settings.py file to be an absolute path, instead of a relative path. Apache's home directory is not necessarily your melt folder, so Django needs an absolute path to specify where it saves your files.

That should be it! Let us know if you have any questions!

Posted by at December 7, 2005 5:18 PM

Trackback Pings

TrackBack URL for this entry:
http://weblog.greenpeace.org/cgi-bin/mv/mt-tb.cgi/826

Comments

checking out svn doesn't work. wrong user/password when trying "anonymous" and blank password.

Posted by: doesnt work at February 18, 2006 4:08 PM

Looking at the current svn version it seems that the script build.py is now called custard-admin.py

Posted by: mihai at October 16, 2006 9:49 AM

Post a comment





Remember Me?