Application structure - Aimlackies/Reporter GitHub Wiki

Here is the basic structure of the application. Some files and folders have been missed as they are automatically generated and / or can be ignored.

Repository root
|
|-migrations
|     |
|     |-versions
|           |
|           |-database migration files (.py)
|
|-reporter_app
|     |
|     |-blueprint folder
|     |     |
|     |     |-__init__.py
|     |     |-routes.py
|     |     |-forms.py
|     |     |-utils.py
|     |
...   ...
|     |
|     |-templates
|     |     |
|     |     |-security
|     |     |    |
|     |     |    |-template files (.html)
|     |     |
|     |     |-blueprint folders
|     |     |    |
|     |     |    |-template files (.html)
|     |     |
...   ...   ...
|     |     |
|     |     |-template_parts
|     |     |    |
|     |     |    |-template files (.html)
|     |
|     |-__init__.py
|     |-cli.py
|     |-forms.py
|     |-models.py
|     |-utils.py
|
|-tests
|     |
|     |-functuonal
|     |     |
|     |     |-blueprint test folders
|     |     |    |
|     |     |    |-test files (.py)
...   ...   ...
|     |
|     |-unit
|     |     |
...   ...   ...
|     |
|     |-conftest.py
|     |-utils.py
|
|-config_testing.py
|-config.py
|-reporter.py
|-requirements.txt
|-setup.py
  • All database changes are added to automatically generated files in the directory migrations/version/. These will contain a up and a down function which tell MySQL how to update the database for new changes and revert to older versions.
  • blueprint folder is used in place of all blueprints the application use. These are individual sections of the application which are all responsible for a set feature (e.g. errors, dashboard or users).
  • The application is defined in __init__.py withing reporter_app/.
  • Any additional command line commands that should be called with flask xxx are defined in cli.py.
  • Even though blueprints define individual sections of the application, any tables / columns are defined in a single model.py file defined in reporter_app/.
  • Front end views are contained within templates. Security (Flask security too) has a dedicated folder and all other templates are within folders for cosponsoring blueprints or template_parts if they are shared between templates (e.g. as imports)