Last week I started studying about how to develop a REST API with Flask. I know very little about Python, basically just syntax and how to run a script, but I'm completely blank when it comes to folder structure and special files (such as the
My first question is about the folder structure, I would like to know what is the best practice for structuring my project. Right now, my project is looking like this (trying to replicate how I do it with Node):
my_project/ -src/ --__init__.py --blueprints/ ---books/ ----__init__.py -tests/ --__init__.py --test_books.py -run.py
(Your answers don't necessarily need to be for a Flask project, if you tell how you structure your random Python projects that would help too!)
My second question is about the
__init__.py file. I've read that by adding that file you are making the folder a
module. I had it inside my
blueprints folder, but I removed it just to see what would happen and my project was unaffected.
So, my questions would be:
- When should I add this file to my folders and when should I not?
- When should I leave that file blank and when should I write code to it?
Thanks in advance for your time and your answers ✨