0
0
Flaskframework~5 mins

Flask project structure conventions - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the app.py file in a Flask project?
The app.py file is the main entry point of a Flask application. It creates the Flask app instance and defines routes and configurations.
Click to reveal answer
beginner
Why do Flask projects often have a templates folder?
The templates folder stores HTML files that Flask uses to render web pages dynamically using the Jinja2 template engine.
Click to reveal answer
beginner
What is the role of the static folder in a Flask project?
The static folder holds static files like CSS, JavaScript, and images that the browser can load directly without processing.
Click to reveal answer
intermediate
Why might a Flask project use a config.py file?
A config.py file stores configuration settings like secret keys, database URLs, and debug mode, keeping them separate from the main code.
Click to reveal answer
intermediate
What is the benefit of organizing Flask code into a package (a folder with __init__.py) instead of a single file?
Using a package allows splitting code into modules for routes, models, and helpers. This keeps the project clean, easier to maintain, and scalable.
Click to reveal answer
Which folder in a Flask project contains HTML templates?
Astatic
Bapp
Cconfig
Dtemplates
Where should you put CSS and JavaScript files in a Flask project?
Atemplates
Bconfig
Cstatic
Dapp.py
What is the main purpose of app.py in Flask?
ADefine routes and create the app instance
BStore CSS files
CHold HTML templates
DConfigure database migrations
Why use a config.py file in a Flask project?
ATo keep configuration settings separate
BTo store static images
CTo write HTML templates
DTo define URL routes
What does adding an __init__.py file to a folder do in a Flask project?
AAdds CSS styles
BMakes the folder a Python package
CCreates a static folder
DDeletes the folder
Describe the typical folder structure of a Flask project and the purpose of each main folder or file.
Think about where you put your HTML, styles, and main code.
You got /5 concepts.
    Explain why organizing Flask code into packages and separate files is helpful as a project grows.
    Compare a messy desk to a tidy one with labeled drawers.
    You got /4 concepts.