Skip to content

anyTV/python-flask-project-structure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Flask Project Structure

Introduction

A boilerplate for REST APIs implement using python flask and pymysql. This project uses python3 and follows the company's Python conventions.

Running the application

  1. Download zip
  2. Extract to your project's folder
  3. Import database/schema.sql and database/seed.sql
mysql -uroot < database/schema.sql
mysql -uroot < database/seed.sql
  1. Install dependecies
python setup.py
  1. Update instance/config.py
  2. Run the app
python run.py

Project Structure

  • app
    • module-1
      • init.py
      • dispatch.py
    • module-n
      • init.py
      • dispatch.py
  • instance
    • env
      • development.py
      • production.py
      • staging.py
    • config.py
  • lib
    • database.py
    • error_handler.py
    • response.py
  • venv
  • setup.py
  • run.py

Request context

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

Author

Freedom! Labs, any.TV Limited DBA Freedom!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages