This project shows one of the possible ways to implement RESTful API server.
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:
.
├── app
│ ├── __init__.py
│ ├── exceptions
│ │ ├── __init__.py
│ │ └── handler.py
│ ├── http
│ │ ├── controllers
│ │ │ ├──__init__.py
│ │ ├── requests
│ │ │ ├──__init__.py
│ │ └── resources
│ │ ├──__init__.py
│ ├── mail
│ │ └── __init__.py
│ ├── models
│ │ └── __init__.py
│ ├── rules
│ │ └── __init__.py
│ └── utils
│ ├── __init__.py
│ ├── common.py
│ ├── http_code.py
│ └── logz.py
├── .env
├── .env.example
├── .gitignore
├── api.py
├── config.py
├── db.py
├── README.md
├── requirements.txt
└── routes.py
- Clone repository.
- Run following commands:
- cd myproject
- python3 -m venv .venv
- . .venv/bin/activate
- pip install -r requirements.txt
- python3 api.py