keokilee / makahiki

An open source framework for creating dorm energy competitions using Django and Pinax.
http://code.google.com/p/kukui-cup
12 stars 8 forks source link

README.md

Introduction

This README describes how to set up your computer for Makahiki Development.

Prerequisites

Obtaining the Kukui Cup Pinax source

Grabbing External Dependencies

The following steps are to download additional libraries and upgrade some of the default ones.

Setting up Makahiki

Running the server

Adding Facebook Integration

The Javascript required to log in to Facebook is included in this application. However, you will need to apply for your own application on Facebook at their Developer Site. Once this is done, it is recommended that you add this to the local_settings.py file. These settings can be added to settings.py, but be aware that a) this file is in public version control, and you don't want others knowing your secret keys and b) subsequent updates may reset the settings.py file.


FACEBOOK_APP_ID = '<APP_ID>'
FACEBOOK_API_KEY = '<API_KEY>'
FACEBOOK_SECRET_KEY = '<SECRET_KEY>'

These can be found in your application's page within the Facebook Developer page.

Troubleshooting

If you visit http://localhost:8000 and a NoneType exception appears, it is isn't your fault! Django/Pinax has an issue with dumping and loading fixtures that depend on foreign keys. In this case, it is the foreign key that connects the django_generic_flatblocks_genericflatblock table to the django_content_type table. There are several ways of fixing this.

The most straightforward way to fix this is to use SQLite Database Browser to update the tables. Open the database file (by default, it is "dev.db") and browse the data of the "django_generic_flatblocks_genericflatblock" table. Note the values of the website header field (which is of type "title"), the website footer field (type "text"), the website image field (type "image"), and the homepage_content_1 field (type "titleandtext"). Next, browse the contents of the "django_content_type" table. Find the app_label "gblocks" and the names "title", "text", "image", and "titleandtext". What you need to do is execute SQL to update the entries in the "django_generic_flatblocks_genericflatblock" table. An example statement is:

UPDATE django_generic_flatblocks_genericflatblock SET content_type_id=<value in django_content_type> WHERE content_type_id=<value in django_generic_flatblocks_genericflatblock>;

Running tests

While Django/Pinax has support for running tests, some of the out of the box tests fail (as of Pinax 0.7.1). You can run the tests using python manage.py test. I created my own script to only run my own tests in the system. You can run those tests by typing python runtests.py. These are the same tests that are run by our continuous integration server.

Other resources

Here are some online Python books that may be helpful when learning the language.

The following tutorials may be helpful when learning about Django and the various packages used by the system.

Further documentation

For information on editing views, consult the Editing Views wiki.