Skip to content

Latest commit

 

History

History
200 lines (123 loc) · 4.7 KB

README.md

File metadata and controls

200 lines (123 loc) · 4.7 KB

Vosae backend application

This is the Vosae backend app.
It exposes Vosae resources though an API. A graphic web-interface is available on Github repo naeka/vosae-web.


Branch Travis-CI build status
master (ready for production) Build Status
develop Build Status

The Vosae backend application is powered by our favorite language, Python, and relies on these amazing technologies:

  • Python
  • Django
  • MongoDB
  • Elasticsearch
  • Celery
  • Redis
  • sqlite (or Mysql)
  • Websockets (through Pusher)
  • Memcached

Install the application

You need to meet these requirements before installing the Vosae backend application:

First, clone the repository:

$ git clone [email protected]:Naeka/vosae-app.git
$ cd vosae-app/

Build the virtualenv

Using virtualenvwrapper - recommanded:

$ mkvirtualenv vosae-app

Or simply with the virtualenv tool:

$ virtualenv --python=python2.7 --distribute ./
$ source bin/activate

Install Python requirements in the virtualenv:

(vosae-app)$ pip install -r requirements.txt

Initialize the database and create a superuser

(vosae-app)$ ./manage.py syncdb --migrate
(vosae-app)$ ./manage.py createsuperuser

This will be the user you should use to connect the first time.
It has access to Django admin (available on vosae-app, /admin/)

Manage static files

The Vosae backend application handle static files with Grunt. There isn't a lot of static files in this app, just a few to handle the authentication process.

You need to have Node.js and Node Package Manager (npm) on your system. If Node isn't on your system, install it now!

First, install grunt dependencies on your system:

$ gem install compass
$ gem install sass
$ gem install sass-rails
$ gem install bootstrap-sass --version 3.1.0.1

Install Grunt:

$ npm install -g grunt-cli

Finally, on the root of vosae-app:

$ npm install

if it doesn't work (on MacOS), add '/usr/local/share/npm/bin' to /etc/paths

Now you can generate static files

Build files for dev and watch directories for changes

$ grunt

Only build files for development

$ grunt build-dev

Launch the app server

Settings

Prior to launch the server, a web endpoint (Ember.JS client) settings must be defined. The VOSAE_WEB_ENDPOINT environment variable is used for this purpose.

For development, it can be more convenient to set this in a local settings file (not tracked by Git).
In this case, create a local.py file in the settings module and fill with:

# -*- coding:Utf-8 -*-

WEB_ENDPOINT = 'http://localhost:8001'

Launch the database

$ cd www/
$ mkdir databases
$ ./mongodb.sh start

Launch Redis if not automatically started by your system

$ redis-server

Launch elasticsearch

$ elasticsearch -f

Activate the virtualenv and launch the dev server

(vosae-app)$ ./manage.py runserver

Launch Celery (within the virtualenv)

(vosae-app)$ ./manage.py celeryd -v 2 -B -s celery -E -l INFO

Feature branches naming

Feature branches are branches used when developing a specific feature. It is used thanks to gitflow.

To install gitflow, follow gitflow instructions.

Code conventions

Django

  • Use of SPACES for indentation - 4-spaces equivalency
  • Class definitions and top methods separated by 2 blank lines, methods inside a class separated by 1 blank line
  • No maximum line length but try to be clear and align on multiple lines
  • Avoid parentheses use when possible for conditional and loop statements

Templates

  • Use of SPACES for indentation - 4-spaces equivalency