Public | Automated Build

Last pushed: 6 months ago
Short Description
https://github.com/kobotoolbox/dkobo
Full Description

Dkobo.

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


Installation on Ubuntu

  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<br>
    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<br>
    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<br>
    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<br>
    npm install<br>
    bower install

  4. Migrate the database

    python manage.py syncdb<br>
    python manage.py migrate

  5. Run the server on port 8000

    python manage.py runserver OR (when actively developing the application) <br>
    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
Docker Pull Command
Owner
kobotoolbox
Source Repository

Comments (0)