courselab / pollex

Open Source Online Poll Application
GNU General Public License v3.0
1 stars 9 forks source link

Reorganize file structure for Flask project #12

Closed ET33 closed 4 years ago

ET33 commented 4 years ago

While studying, I found out that there are some common ways to structure the files and directories of a Flask project. Many tutorials end up with a main file that's big and looks messy as the project grows.

I suggest we use a more appropriate file structure to prevent this scenario.

ET33 commented 4 years ago

Currently working on it, and it looks something like this:

pollex-flask
├── ...                 # other files (Dockerfile, Makefile, etc.)
├── run.py              # execute this to run the application
├── app/
│   ├── __init__.py     # contains the general setup for the application
│   └── views/          # this is where all the routes are defined
│       ├── auth.py
│       └── ...
│
├── config/             # contains all configuration files
│   ├── __init__.py
│   ├── default.py
│   ├── development.py
│   └── production.py
│
└── instance/           # directory for sensitive information
    └── config.py

This is heavily based on this doc

LuisF3 commented 4 years ago

Looks good and organized!

monacofj commented 4 years ago

Really, looks good, indeed.