Butterfly
Download
git clone git@github.com:juigilkishore/butterfly.git
cd butterfly
Install Dependencies
sudo apt-get install python-virtualenv $(cat dependencies.txt)
virtualenv butterfly-env
source butterfly-env/bin/activate
pip install -r requirements.txt
Database creation
For MySQL database
mysql -uroot -p
mysql> CREATE DATABASE butterfly;
mysql> GRANT ALL PRIVILEGES ON butterfly.* TO 'butterflyuser'@'localhost' IDENTIFIED BY 'butterflypass';
mysql> GRANT ALL PRIVILEGES ON butterfly.* TO 'butterflyuser'@'%' IDENTIFIED BY 'butterflypass';
mysql -ubutterflyuser -p
mysql> USE butterfly;
For SQLite database
touch butterfly.db
Edit Configuration
Edit "connection" key in "Database" section in the etc/butterfly.conf configuration file
For MySQL database
connection=mysql+mysqldb://<butterflyuser>:<butterflypass>@localhost/<butterfly-db-name>
For SQLite database
connection=sqlite:///butterfly.db
Database initialize
Create all the tables and populate with initial values
source butterfly-env/bin/activate
python butterfly.py --action db_init --config etc/butterfly.conf
Database delete
Drop all the tables
source butterfly-env/bin/activate
python butterfly.py --action db_drop --config etc/butterfly.conf
Run service
Run the butterfly service
source butterfly-env/bin/activate
python butterfly.py --action run --config etc/butterfly.conf
API list
User APIs
- GET /user Retrieves all user details
- GET /user/ Retrieves user 's details
- POST /user Creates a user
- PUT /user/ Edits user 's details
- DELETE /user/ Delete user
Lesson APIs
- GET /lesson Retrieves all lesson details
- GET /lesson/ Retrieves lesson 's details
- POST /lesson Creates a lesson
- PUT /lesson/ Edits lesson 's details
- DELETE /lesson/ Delete lesson
Goal APIs
- GET /goal Retrieves all goal details
- GET /goal/ Retrieves goal 's details
- POST /goal Creates a goal
- PUT /goal/ Edits goal 's details
- DELETE /goal/ Delete goal
Lesson Activity APIs
- GET /user//activity/lesson Retrieves all lesson activity details of
- GET /user//activity/lesson/ Retrieves lesson activity of 's details for
- POST /user//activity/lesson Creates a lesson activity for
- PUT /user//activity/lesson/ Edits lesson activity 's details for
- DELETE /user//activity/lesson/ Delete lesson activity 's details for
Goal Activity APIs
- GET /user//activity/goal Retrieves all goal activity details of
- GET /user//activity/goal/ Retrieves goal activity of 's details for
- POST /user//activity/goal Creates a goal activity for
- PUT /user//activity/goal/ Edits goal activity 's details for
- DELETE /user//activity/goal/ Delete goal activity 's details for