Minimal python restful API
Switch branches/tags
Nothing to show
Clone or download
Latest commit f3cd7e6 Oct 10, 2018
Permalink
Failed to load latest commit information.
src Ensure API doesn't listen to 0.0.0.0 Jun 20, 2016
test add mock example Jul 6, 2015
.gitignore Initial commit Feb 27, 2015
README.md Update README.md Oct 10, 2018
docker-compose.yml Improve boilerplate Jun 5, 2015
requirements.txt Fix requirements file Nov 23, 2015

README.md

This repo is deprecated, please use https://github.com/antkahn/flask-api-starter-kit instead

Installation

git clone git@github.com:theodo/flask-boilerplate.git && cd flask-boilerplate
docker-compose run --rm server pip install -r requirements.txt --user --upgrade
docker-compose up -d server

Accessing containers

Require Docker >= 1.3

# use 'docker ps' to see the list of your containers
docker exec -it flaskboilerplate_db_1 psql -Upostgres
docker exec -it flaskboilerplate_server_1 bash

Migration process

# Prior to the first migration
docker-compose run --rm server python src/manage.py db init

# Create a new version of the database
docker-compose run --rm server python src/manage.py db migrate
# check file + remove comment + improve file if needed
sudo vim migration/versions/<migration_id>.py

# Upgrade your database to the last version
docker-compose run --rm server python src/manage.py db upgrade

Run tests

docker-compose run --rm server python -m unittest

Commands

# Screenshot of python vendors
docker-compose run --rm server pip freeze > requirements.txt

# Run a command in the server container:
docker-compose run --rm server <command>