A django project for developing components of the KoBoToolbox, including the new version of KoBoForm
-
Clone the project:
git clone https://github.com/kobotoolbox/dkobo.git -
Activate a python virtualenv.
It's suggested that you use virtualenv wrapper, which provides the "mkvirtualenv" and "workon" commands
However, without that, you can still create a virtualenv e.g. named pykobovirtualenv ~/pykobo -
If in production, set production environment variables. (See below)
-
Install python:
pip install -r requirements.txt -
Ensure system packages are installed:
apt-get install python2.7-devapt-get install libxml2 libxml2-dev libxslt1-dev -
Special package installs (require custom repositories):
apt-get install postgresql-server-dev-9.3apt-get install nodejs -
Install javascript dependencies:
npm install
bower install -
Build javascript and stylesheet dependencies
grunt build -
Continue with "launching the server" (optionally skipping any repeated steps)
-
Ensure the latest code is pulled
git pull origin master -
Activate the virtualenvironment
example virtualenv named pykobo
source ~/pykobo/bin/activate -
Consider installing any requirements that have not been installed
pip install -r requirements.txt# this installs python dependencies inside the vitualenv
npm install
bower install -
Migrate the database
python manage.py syncdb
python manage.py migrate -
Run the server on port 8000
python manage.py runserverOR (when actively developing the application)
python manage.py gruntserverThis is an alias for running 'grunt' in the background.
DJANGO_DEBUG=False
DJANGO_SECRET_KEY=<use a unique django secret key here>
The server should run in development / debug mode by default, but if you want to change it you can run the command
`source scripts/set_debug.sh true` #sets development mode<br>
or<br>
LOCAL: source scripts/set_debug.sh true
LOCAL: source scripts/set_debug.sh false
HEROKU: sh scripts/set_debug.sh --heroku true
HEROKU: sh scripts/set_debug.sh --heroku false
`source scripts/set_debug.sh false` #sets production mode
default task: triggers requirejs:compile_xlform, build_css, and watch for changes
triggers requirejs:compile_xlform, build_css
- Creates js and css dependencies
- Used when launching production
- Runs
buildand generates modernizr.js file for use when django is not in debug mode.
- Runs
sass:dist,cssmin:strip_duplicates,cssmin:dist
- Runs
build,karma:unit