- Python 3
- Clone repo.
- pip install virtualenvwrapper into Python 3 directory.
- copy the following into User's .bashrc file and execute:
export WORKON_HOME=~/Envs
mkdir -p $WORKON_HOME
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.4
source /usr/local/bin/virtualenvwrapper.sh - Make a virtual environment for the app $mkvirtualenv demo
- Navigate to the project route and $pip install -r requirements.txt
- Run tests with $python manage.py test
- Run development server with $python manage.py runserver
- Development
- The default configuration. Uses the development database and pretty printed JSON by default.
- To enable minified json set the environment variable MINIFY_JSON=true.
- Testing
- Used when testing by default. Uses a testing database that has all tables dropped after every test.
- Production
- A simulated production configuration. Uses the production database and compact JSON.
- Enable by setting the environment variable FLASK_CONFIG=production
- First initialize the migrations folder: $python manage.py db init
- Generate the migration script: $python manage.py db migrate
- After inspecting the generated migration script: $python manage.py db upgrade
- Running tests is straightforward: $python manage.py test
- To include coverage (with generated html): $python manage.py test --coverage
- Flask-Admin views are available at BASE_URL/admin/group
- While models can not be created, existing models can be updated and Users added or removed from Groups
GET - Returns a list of all Users ordered alphabetically.
POST params: name (required), email (required) - Creates a new user. Email must be unique
GET - Returns a list of all Users ordered by the number of groups they are members of.
GET - Returns a User including a listing of the User's group memberships (id only)
DELETE - Deletes a User.
PUT params: name(required), email (required) - Updates an existing user.
GET - Returns a list of the Users's Group memberships.
PUT params: group_id (required) - Adds the User to the specified Group.
DELETE params: group_id (required) - Removes the User from the specified Group.
GET - List all Groups ordered alphabetically
POST params: name (required), description (optional) - Creates a Group. Name must be unique
GET - Returns a list of all Groups sorted by the number of members (ascending)
GET - Returns a Group including a listing of the Group's users (id only)
DELETE - Deletes a Group (will not delete Users that are members)
PUT params: name (required), description (optional) - Updates a Group. Name must be unique.
GET - Returns a list of a Group's users.