InstallationΒΆ
To install the OppiaMobile server you will first need to have a running Django server installation with both the South and TastyPie libraries installed. We recommend that you use virtualenv to sandbox your python libraries from others on your server.
Run
python manage syncdbto create the tables for South and TastyPie in your database (if you haven’t already done so during their installations)Install OppiaMobile, run
pip install django-oppia- Edit your
settings.pyfile as follows: Add
oppiato your INSTALLED_APPS like this:INSTALLED_APPS = ( ... 'oppia', )Add the following code:
from oppia import local_settings local_settings.modify(globals())
Ensure you have the following standard Django settings configured:
Add a new setting
COURSE_UPLOAD_DIR, this should a read/writable directory by your webserver user, for example:COURSE_UPLOAD_DIR = '/home/uploads/'
This directory will store any uploaded courses, but it should not be web accessible (the server app will control access to the downloads)
- Edit your
Include the oppia URLconf in your project
urls.pylike this:url(r'^', include('oppia.urls')),
It is expected that you would like the app running from the root of your domain name. If this is not the case, then you can alternatively use:
url(r'^oppia/', include('oppia.urls')),
However, you may need to change some of the
LOGIN_EXEMPT_URLSin thelocal_settings.pyfileRun
python manage.py migrate oppia,python manage.py migrate oppia.quizandpython manage.py migrate oppia.vizto create the oppia models.Run
python manage.py collectstaticthis will copy all the required javascript, images, css and other static files are copied to your STATIC_ROOTRun
python manage.py loaddata default_badges.jsonthis will create the default badges in your database.Your OppiaMobile server should now be up and running: http://localhost:8000/ (or at http://localhost:8000/oppia depending on how you configured your
urls.pyfile)
Finally you should set up a cron task to run the
oppia/cron.pyscript regularly. This script tidies up the course download directory of temporary download files and also checks which course badges should be awarded.Exactly how you call
cron.pywill depend on your environment, but as an example on my development server (and using virtualenv) I use a wrapper shell script with the following content:#!/bin/bash cd /home/alex/data/development/home_alexlittle_net/venv/ # <- path to my virtualenv source bin/activate # <- activate the virtualenv PYTHONPATH="${PYTHONPATH}:/home/alex/data/development/" # <- path to my Django project root export PYTHONPATH export DJANGO_SETTINGS_MODULE=home_alexlittle_net.settings # <- my main Django settings (relative to the Django project path) python /home/alex/data/development/django-oppia/oppia/cron.py # <- full path to the cron.py fileThis script handles activating the virtualenv correctly and ensuring all the Django modules/apps can be accessed. I then have my cron call this wrapper script every 2 hours.