Navigation Menu

Skip to content

schoeller/dkobo

 
 

Repository files navigation

Dkobo.

Build Status

A django project for developing components of the KoBoToolbox, including the new version of KoBoForm


Installation

  1. Clone the project:

    git clone https://github.com/kobotoolbox/dkobo.git

  2. 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 pykobo virtualenv ~/pykobo

  3. If in production, set production environment variables. (See below)

  4. Install python:

    pip install -r requirements.txt

  5. Ensure system packages are installed:

    apt-get install python2.7-dev apt-get install libxml2 libxml2-dev libxslt1-dev

  6. Special package installs (require custom repositories):

    apt-get install postgresql-server-dev-9.3 apt-get install nodejs

  7. Install javascript dependencies:

    npm install
    bower install

  8. Build javascript and stylesheet dependencies

    grunt build

  9. Continue with "launching the server" (optionally skipping any repeated steps)

Launching the server

  1. Ensure the latest code is pulled

    git pull origin master

  2. Activate the virtualenvironment

    example virtualenv named pykobo
    source ~/pykobo/bin/activate

  3. 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

  4. Migrate the database

    python manage.py syncdb
    python manage.py migrate

  5. Run the server on port 8000

    python manage.py runserver OR (when actively developing the application)
    python manage.py gruntserver This is an alias for running 'grunt' in the background.


Production environment variables

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

Grunt commands

grunt (no arguments)

default task: triggers requirejs:compile_xlform, build_css, and watch for changes

grunt build

triggers requirejs:compile_xlform, build_css

  • Creates js and css dependencies
grunt build_all
  • Used when launching production
  • Runs build and generates modernizr.js file for use when django is not in debug mode.
grunt build_css
  • Runs sass:dist, cssmin:strip_duplicates, cssmin:dist
grunt test
  • Runs build, karma:unit

About

A django project for developing components of the kobotoolbox

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 39.9%
  • CoffeeScript 38.9%
  • CSS 11.4%
  • Python 9.5%
  • Other 0.3%