You need to have the following installed in your system:
- python 2.7.x
- vagrant 1.6.x or later: http://www.vagrantup.com/downloads.html
- virtualbox 4.3.x or later: https://www.virtualbox.org/wiki/Downloads
- virtualenv 1.11.6 (optional but highly recommended): pip install virtualenv
Run all the actions below in a virtual env:
cd rafee
pip install -r requirements-dev.txt
vagrant up # 1st time, provision will take some time. Especially package install. If something fails, just do "vagrant provision" or "vagrant reload --provision"
After vagrant finishes booting the VM, you can access the GUI via http://localhost:8888. A superuser is created automatically when loading the dev vm. You can login using the credentials:
username: pp
password: pp
The REST API is accessed via http://localhost:8888/api/v1
You can checkout the API docs at http://localhost:8888/api/v1/docs
In order to run the unittests:
./runtests.sh [-m] # Linux only, for windows you can check the script to know what to do
The -m flag run the migrations. This is only needed to generate initial migrations (until they are comitted) or whenever a change in the models is done. Otherwise it can be left out to run the tests faster
running tests with coverage:
./runtests.sh -c # Places html coverage report under htmlcov
Run runtests.sh -h
to see other options.
When adding new celery tasks, you will need to reload django (uwsgi) and celery.
ansible-playbook -i provisioning/inventory/ --tags=uwsgi,celery provisioning/site.yml --limit=vagrant
If the task belongs to a newly added django app, before reloading make sure is added to the INSTALLED_APPS (celery autodiscover tasks from there).
Install the latest stable version of Node. To verify is properly installed, both commands below should return output:
node --help
npm --help
Install the sass and compass Gems to preprocess style:
gem install sass
gem install compass
Install ember-cli (0.2.2 or later is required) and bower (you might need sudo for this):
npm install -g ember-cli
npm install -g bower
In order to install the frontend dependencies, run
cd rafee/frontend && ember install
In order to run the ember dev server (which provides automatic rebuild and browser reload), run:
cd rafee/frontend
ember server
You can then either navigate to http://localhost:4200 for the app (served by ember server) or go to http://localost:888 to get the app served by nginx on the dev vm. The advantage of using ember server is automatic browser reload (which is very nice while developing)
You need to have PhantomJS installed to be able to run the tests from the command line:
npm install -g phantomjs
The run
ember server
and navigate to http://localhost:4200/tests to see the frontend tests report.