Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close
CCIW source code
================

In case I get hit by a bus, or for the freak possibility that someone wants to
help me with this site, here are some tips for developers.

Installation hints
------------------

- pip install -r requirements.txt

  For development/deployment, you also need:

  - Fabric
  - django-debug-toolbar
  - django-anonymizer

- The fabfile contains info about how to develop and deploy

- You need to create a cciw/settings_priv.py with the various settings that I cannot
  release publicly (database, passwords, secret key).

  To be able to deploy, you need also need settings_production.py or settings_staging.py
  The fabfile depends on these files existing.

- For creating the database, there is a complete set of South migration
  scripts. However, some of the data migration scripts may depend on certain
  data being present in the database. It is therefore better to get
  a dump of live DB and use that. Use the anonymize_data command to
  clear the DB of sensitive live data.


Tests
-----

Tests can be run like so:

$ fab test

or

$ ./manage.py test --settings=cciw.settings_tests cciw.cciwmain.tests cciw.bookings.tests cciw.officers.tests




Components
----------

The major components of the site are:

1) Information about the camps that are run. This is all on publically
   accessible parts of the site.

2) Camp forums and photo galleries. Now largely unused. You have to log in
   as a Member to post content.

3) Booking - for campers (or their parents) to book places on camp and pay.

4) Admin.

   Used by a few people to add camp information, for example. Also used by
   booking secretary to add/manage information about bookings, and various other
   staff functions.


5) Leaders and officers.

   This contains utilities for leaders:

   * to manage an officer list for their camp
   * to view applications from officers
   * to manage references for officers
   * to download booking information about campers booked on the camp

   ...and other things

   It also contains utilities for officers to submit their application forms,
   and helps for the booking secretary.

   Where possible, the Django admin is used for some of these functions.


Login
-----

Because of the above components, there are 3 separate login systems:

* The standard django.contrib.auth.User system, used by the Django admin and the
  officers section (staff members).

* A custom login system for the camp forums, based on the Member model,
  (very similar to contrib.auth.User, with passwords etc.)

* A custom login system for booking places on camp, which is passwordless, based
  on BookingAccount.


Project history
---------------

The first evolution of the project had a large models.py (cciw.cciwmain.models)
that was split into sub modules. This has now been re-organised into
cciw.cciwmain (camp and camp site information, and other core website
functionality), cciw.forums and cciw.sitecontent. cciw.officers and
cciw.bookings are newer and were written as separate apps from the start.

Although the apps have been mainly separated, there are dependencies between
them, and places where they have not been separated.

- almost all apps use cciw.cciwmain.models.Camp, and other common functionality
  found in cciwmain
- tests for forums and sitecontent remain in cciwmain. This is partly because
  cciwmain.views uses forums.views.
- test fixtures are re-used by different apps.


Other notes
-----------

Views are done using a mixture of classic functions and Class Based Views,
depending on whether the move to CBVs was worth the effort. This means that
there is sometimes some duplication between the function based way of doing
something and the equivalent CBV way, and you need to be comfortable with both
styles.


Crontab
-------

CCIW_PYTHON=/home/cciw/webapps/cciw_django/venv-py3/bin/python3.3
CCIW_MANAGE=/home/cciw/webapps/cciw_django/src/manage.py

CCIW_STAGING_PYTHON=/home/cciw/webapps/cciw_staging_django/venv-py3/bin/python3.3
CCIW_STAGING_MANAGE=/home/cciw/webapps/cciw_staging_django/src/manage.py

*       * * * * $CCIW_PYTHON $CCIW_MANAGE send_mail 2>> ~/.django-mailer-cron.log
5,35    * * * * $CCIW_PYTHON $CCIW_MANAGE fix_mailing_lock
0,20,40 * * * * $CCIW_PYTHON $CCIW_MANAGE retry_deferred 2>> ~/.django-mailer-deferred-cron.log
15      1 * * * $CCIW_PYTHON $CCIW_MANAGE clear_securedownload_links
*/10    * * * * $CCIW_PYTHON $CCIW_MANAGE process_payments
0       2 * * * $CCIW_PYTHON $CCIW_MANAGE cleanup
*       * * * * $CCIW_PYTHON $CCIW_MANAGE handle_mailing_lists 2>> ~/.cciw-mailings-cron.log

# expire_bookings must be run only once an hour
30      * * * * $CCIW_PYTHON $CCIW_MANAGE expire_bookings
*/10    * * * * /home/cciw/webapps/cciw_django/venv-py3/bin/fab -f /home/cciw/webapps/cciw_django/src/fabfile.py production local_webserver_start

# expire_bookings must be run only once an hour
30      * * * * $CCIW_STAGING_PYTHON $CCIW_STAGING_MANAGE expire_bookings
18      1 * * * $CCIW_STAGING_PYTHON $CCIW_STAGING_MANAGE clear_securedownload_links
3       2 * * * $CCIW_STAGING_PYTHON $CCIW_STAGING_MANAGE cleanup

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.