Flow of Computer Science
Flocs is an intelligent web application for learning computer science, aiming at creating a flow experience. Flocs is developed by Adaptive Learning group at Faculty of informatics, Masaryk university.
Start working on the project
-
Install Python 3, virtualenv, virtualenvwrapper and npm:
$ sudo pacman -S python python-virtualenv python-virtualenvwrapper npm
-
Install Grunt and Bower using npm:
$ sudo npm install -g grunt-cli karma-cli bower
-
Configure virtualenv and virtualenvwrapper by adding the following two lines in your
~/.bashrc
:export WORKON_HOME=~/.virtualenvs source /usr/bin/virtualenvwrapper.sh
Load the changes:
$ source ~/.bashrc
-
Clone the project repository:
$ git clone https://github.com/effa/flocs.git
-
Create virtual environment and bind it with the project directory:
$ cd flocs $ mkvirtualenv flocs && setvirtualenvproject
The name of the virtual envirnoment (flocs) should now appear in front of the prompt.
-
Install dependencies and initialize DB:
$ make update
The make update
command uses pip, npm and bower to install both backend and frontend dependencies (including django and pylint) and it also sets up the database for development. (See Makefile for details.)
You can check that Django was installed correctly by command django-admin --version
,
which should output 1.8.2.
You can deactivate the virtual environment by calling deactivate
.
Workflow
-
Start the virtual environment and jump to the project directory:
$ workon flocs
-
Pull the changes from the repository.
$ git pull
-
Update dependencies and database:
$ make update
-
Take a look at the code written by your friends (quick code review). Also look at the documentation, diagrams and issues to decide what feature you want to implement.
-
Create and checkout a git branch for the implemented feature.
$ git checkout -b name_of_the_feature
-
Write unit tests for the implemented feature (and possibly integration tests as well). Check that the tests don't pass.
$ make test
-
Develop the feature. Enjoy it, experience the state of flow :-)
-
If you need a python console (with all models automatically imported), call:
$ ./manage.py shell_plus
-
If you need a testing server, call:
$ ./manage.py runserver
-
If you change data in fixtures and want to load them to the database:
$ make db-load-data
-
If you change the data model, create and apply a migration:
$ ./manage.py makemigrations $ ./manage.py migrate
-
If you are working on frontend, you need to start the testing server and run
grunt watch
task to automatically apply all changes into a development build (cancatenating html partials, JavaScript and CSS files, compiling index.html, etc.). This can be done by a single command:$ ./manage.py gruntserver
-
Take a regular breaks (e.g. after 25 minuts), stretch yourself (including your eyes).
-
Test the implemented feature and check the code by pylint:
$ make test $ make check
-
Commit changes:
$ git add changed_files $ git commit -m "feature X implemented"
-
Merge the feature branch to the master branch:
$ git checkout master $ git merge name_of_the_feature
-
Push changes to the GitHub:
$ git push
-
Deactivate the virtual environment:
$ deactivate
-
Celebrate the developed feature with some physical exercise and healthy snack.
Additional recommendations
- Check our style guide.
- Check our development tools wiki page.
- If you are using vim, take a look at syntastic and vim-fugitive plugins.