This project shows one of the possible ways to implement RESTful API server.
There are implemented two models: User and Scripts
Main libraries used:
- Flask-Migrate - for handling all database migrations.
- Flask-RESTful - restful API library.
- Flask-Script - provides support for writing external scripts.
- Flask-SQLAlchemy - adds support for SQLAlchemy ORM.
Project structure:
.
├── README.md
├── app.py
├── endpoints
│ ├── __init__.py
│ ├── scripts_runner
│ │ ├── __init__.py
│ │ ├── runner.py
│ │ └── resource.py
│ ├── scripts
│ │ ├── __init__.py
│ │ ├── model.py
│ │ └── resource.py
│ └── users
│ ├── __init__.py
│ ├── model.py
│ └── resource.py
├── manage.py
├── requirements.txt
└── settings.py
- endpoints - holds all endpoints.
- app.py - flask application initialization.
- settings.py - all global app settings.
- manage.py - script for managing application (migrations, server execution, etc.)
- Clone repository.
- pip install requirements.txt
- Run following commands:
- export FLASK_APP=manage.py
- LC_ALL=en_us
- export LC_ALL
- flask db init
- flask db migrate
- flask db upgrade
- flask run
- Start server by running python manage.py runserver