From 463a7e9028af9450064f02a74e77c9cb5ca99fcb Mon Sep 17 00:00:00 2001 From: Joseph Turian Date: Sun, 21 Feb 2010 18:59:00 -0500 Subject: Fixed instructions for using badges --- INSTALL | 24 +++++++++++++++++++++++- INSTALL.webfaction | 21 +++++++++++++++++++++ cron/multi_award_badges | 10 ++++++++++ cron/once_award_badges | 10 ++++++++++ cron/send_email_alerts | 14 ++++++++++---- 5 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 cron/multi_award_badges create mode 100644 cron/once_award_badges diff --git a/INSTALL b/INSTALL index d807a13d..8ecabb88 100644 --- a/INSTALL +++ b/INSTALL @@ -242,7 +242,7 @@ WSGIPythonEggs /var/python/eggs #must be readable and writable by apache This function at the moment requires Django 1.1 - edit paths in the file cron/send_email_alerts + edit paths in the file cron/send_email_alerts. set up a cron job to call cron/send_email_alerts once or twice a day subscription sender may be tested manually in shell by calling cron/send_email_alerts @@ -263,6 +263,28 @@ There are some demo scripts under sql_scripts folder, including badges and test accounts for CNProg.com. You don't need them to run your sample. +9. Badges + + 1. You should run the SQL commands in: + + sql_scripts/badges.sql + + 2. Edit paths in the file `cron/multi_award_badges`. (This + file doesn't yet exist in the git repositories, so just + copy `cron/send_email_alerts` and make sure the command + `multi_award_badges` is executed.) + + 3. Run `cron/multi_award_badges` to make sure it works okay. + + 4. Use `crontab -e` to call `cron/multi_award_badges` maybe four + times an hour. + + 4,19,34,49 * * * * ~/webapps/osqa_server/projects/MYOSQA/cron/multi_award_badges + + 5. Repeat steps 1-4 for `cron/once_award_badges`. + + + C. CONFIGURATION PARAMETERS #the only parameter that needs to be touched in settings.py is diff --git a/INSTALL.webfaction b/INSTALL.webfaction index b7c79a24..401971a0 100644 --- a/INSTALL.webfaction +++ b/INSTALL.webfaction @@ -233,6 +233,27 @@ Create a Project ln -sd ~/webapps/osqa_server/projects/MYOSQA/site_media ~/webapps/OSQA_STATIC/MYOSQA/site_media + Set up the badges: + + 1. You should run the SQL commands in: + + sql_scripts/badges.sql + + 2. Edit paths in the file `cron/multi_award_badges`. (This + file doesn't yet exist in the git repositories, so just + copy `cron/send_email_alerts` and make sure the command + `multi_award_badges` is executed.) + + 3. Run `cron/multi_award_badges` to make sure it works okay. + + 4. Use `crontab -e` to call `cron/multi_award_badges` maybe + four times an hour. + + 4,19,34,49 * * * * ~/webapps/osqa_server/projects/MYOSQA/cron/multi_award_badges + + 5. Repeat steps 1-4 for `cron/once_award_badges`. + + Configure Apache2 ---------------- diff --git a/cron/multi_award_badges b/cron/multi_award_badges new file mode 100644 index 00000000..df58155a --- /dev/null +++ b/cron/multi_award_badges @@ -0,0 +1,10 @@ +#!/bin/sh + +WORKON_HOME=~/envs/osqa +PROJECT_ROOT=~/webapps/osqa_server/projects/osqa/ + +# activate virtual environment +. $WORKON_HOME/bin/activate + +cd $PROJECT_ROOT +python manage.py multi_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 diff --git a/cron/once_award_badges b/cron/once_award_badges new file mode 100644 index 00000000..12414969 --- /dev/null +++ b/cron/once_award_badges @@ -0,0 +1,10 @@ +#!/bin/sh + +WORKON_HOME=~/envs/osqa +PROJECT_ROOT=~/webapps/osqa_server/projects/osqa/ + +# activate virtual environment +. $WORKON_HOME/bin/activate + +cd $PROJECT_ROOT +python manage.py once_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 diff --git a/cron/send_email_alerts b/cron/send_email_alerts index 6358b599..6c9e154d 100644 --- a/cron/send_email_alerts +++ b/cron/send_email_alerts @@ -1,4 +1,10 @@ -PYTHONPATH=/path/to/dir/above/forum -export PYTHONPATH -APP_ROOT=$PYTHONPATH/nmr-forum2 -/path/to/python $APP_ROOT/manage.py send_email_alerts +#!/bin/sh + +WORKON_HOME=~/envs/osqa +PROJECT_ROOT=~/webapps/osqa_server/projects/osqa/ + +# activate virtual environment +. $WORKON_HOME/bin/activate + +cd $PROJECT_ROOT +python manage.py send_email_alerts >> $PROJECT_ROOT/log/cron_mail.log 2>&1 -- cgit v1.2.3-1-g7c22