A boilerplate for REST APIs implement using python flask and pymysql. This project uses python3 and follows the (company's Python conventions)(https://github.com/anyTV/Python-conventions).
- Download zip
- Extract to your project's folder
- Import
database/schema.sql
anddatabase/seed.sql
mysql -uroot < database/schema.sql
mysql -uroot < database/seed.sql
- Install dependecies
python setup.py
- Update instance/config.py
- Run the app
python run.py
- app
- module-1
- init.py
- dispatch.py
- module-n
- init.py
- dispatch.py
- module-1
- instance
- env
- development.py
- production.py
- staging.py
- config.py
- env
- lib
- database.py
- error_handler.py
- response.py
- venv
- setup.py
- run.py
app - contains the files for the main app
module-n - contains the files for secific module (eg. user module)
module-n/dispatch.py - this file contains all the request context and will be responsible for the routing and setting request related functions.
module-n/init.py will contain all the functions native to the object. All functions and variables in this file most not be dependent on the request context. eg. the function "register" should be put in dispatch while the function "create user" is in init.py. The function register is responsible for getting all the clean data from the request.
instance - contains all the config files.
lib - contains all the core files
util - contains helper functions