Boilerplate of Flask for REST API with VSCode and Pipenv.
- Docker installed
git clone https://github.com/keidrun/boilerplate-flask-for-rest-api-with-vscode-pipenv.git
cd boilerplate-flask-for-rest-api-with-vscode-pipenv
docker-compose up
It's necessary to insatll ptvsd
locally for Remote Debugging.
pip install ptvsd
Set FLASK_ENV=debugging
in docker-compose.yml
.
...
environment:
- FLASK_ENV=debugging
...
FLASK_ENV | Description |
---|---|
puroduction | Activate flask puroduction mode |
development | Activate flask development mode |
debugging | Use remote debugging config and no reload |
testing | Enable flask TESTING flag |
docker-compose up
Execute debugging in VSCode
docker-compose -f docker-compose.test.yml up -d
docker-compose -f docker-compose.test.yml exec web pytest -sv --cov=src --cov-report term-missing test/
Method | URI | Data |
---|---|---|
POST | /api/users | name,age,gender,email |
GET | /api/users | - |
GET | /api/users/:id | - |
PUT | /api/users/:id | name,age,gender,email |
DELETE | /api/users/:id | - |