A minimal boilerplate for creating RESTful services using Flask, SQLAlchemy and Flask-RestPlus. This boilerplate has swagger-UI) [for personal use]
- capabilities of establishhing connection to any database using
SQLAlchemy. - a
service loggerfor logging all the events, warnings, errors, etc. - a placeholder for declaring all your
constants. - a placeholder for all your declared
database models. - entire codeset is config-driven.
- hosting of
swagger-UIfor your RESTful API's documentation. - hosting
multiple namespacesin the routes. - a
custom response generatorfor the payloads.
- install all the requirements from
requirements.txt
pip install -r requirements.txt - make necessary changes in
config.ini- add
hostaddress (default="127.0.0.1") - add
portaddress (default=5000) - set a
namefor the flask restful service (default="flask-minimal-boilerplate") - add the
database url(default="postgresql://scott:tiger@localhost/sample_db")
- add
- create a directory called logs in the current working directory. This is where all your log fiels will be stored.
├── src
│ ├── core
| | ├── db_connection.py
| | ├── models.py
│ ├── instance
| | ├── config.py
| | ├── flask_app.py
│ ├── misc
| | ├── constants.py
| | ├── db_misc_functions.py
| | ├── response_generator.py
| | ├── service_logger.py
│ ├── routes
| | ├── item_1
| | | ├── item_1_route_1.py
| | ├── item_2
| | | ├── item_2_route_1.py
│ ├── namespaces.py
├── config.ini
├── requirements.txt
├── run.py
- after having setup everything above, run the program using
python run.py