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 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 can be run like so:

$ fab test


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


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.


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




*       * * * * $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
0       7 * * * $CCIW_PYTHON $CCIW_MANAGE payment_reminder_emails

# expire_bookings must be run only once an hour
30      * * * * $CCIW_PYTHON $CCIW_MANAGE expire_bookings
*/10    * * * * /home/cciw/webapps/cciw_django/venv/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


PayPal is integrated using IPN.

To test in development, you will need to use "fab run_ngrok".


The most confusing thing about PayPal is all the accounts.

The main account for receiving money: paypal@cciw.co.uk

In addition, there are sandbox accounts for testing.


This is managed from:

Site: https://developer.paypal.com
Login: paypal@cciw.co.uk

From this site, you can create/manage various sandbox accounts which play the
role of buyer/seller:


'Buyer' account:
Email: paypal-buyer@cciw.co.uk
Password: asdfghjk

'Seller' account - this is the one you need to test PayPal interactions in development
Email: paypal-facilitator@cciw.co.uk
Password: qwertyui

These accounts can be used to log in on www.sandbox.paypal.com/