0
0
Djangoframework~5 mins

Template configuration and directories in Django - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the TEMPLATES setting in Django?
The TEMPLATES setting tells Django where to find template files and how to process them. It configures template engines and directories.
Click to reveal answer
beginner
Where do you usually place your HTML template files in a Django project?
Templates are usually placed inside a folder named templates within each app or in a project-level templates directory.
Click to reveal answer
intermediate
What does the 'DIRS' option inside the TEMPLATES setting do?
The 'DIRS' option is a list of folders where Django looks for templates outside of app folders. It helps include project-wide templates.
Click to reveal answer
intermediate
How does Django find templates inside apps?
Django finds templates inside apps if 'APP_DIRS' is set to True in the TEMPLATES setting. It looks inside each app's templates folder.
Click to reveal answer
beginner
Why is it good to organize templates in subfolders named after apps?
Organizing templates in subfolders named after apps avoids name conflicts and makes it easier to find templates related to each app.
Click to reveal answer
In Django, which setting controls where templates are loaded from?
ASTATICFILES_DIRS
BTEMPLATES
CINSTALLED_APPS
DMIDDLEWARE
What does setting 'APP_DIRS': True do in Django's template config?
AEnables loading templates from each app's templates folder
BDisables template loading
CLoads templates only from project-level folders
DChanges template engine to Jinja2
Where should you put templates that are shared across multiple apps?
AIn the migrations folder
BInside a single app's templates folder
CIn the <code>DIRS</code> list folders in <code>TEMPLATES</code>
DIn the static files folder
What is the recommended folder name for templates inside a Django app?
Astatic
Bviews
Cmedia
Dtemplates
Why might you create subfolders inside the templates folder named after your app?
ATo avoid template name conflicts and organize templates
BTo speed up server startup
CTo store static files
DTo configure middleware
Explain how Django uses the TEMPLATES setting to find and load templates.
Think about where templates live and how Django knows where to look.
You got /4 concepts.
    Describe best practices for organizing template files in a Django project with multiple apps.
    Consider how to keep templates clear and easy to find.
    You got /4 concepts.