0
0
Djangoframework~20 mins

Django project structure walkthrough - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Django Structure Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What is the role of the manage.py file in a Django project?
In a typical Django project, what does the manage.py file do when you run commands like python manage.py runserver?
AIt acts as a command-line utility that lets you interact with the Django project, like running the server or migrations.
BIt contains the main settings and configuration for the Django project.
CIt stores the database models and schema definitions.
DIt is the template file that defines the HTML layout for the project.
Attempts:
2 left
💡 Hint
Think about what you type in the terminal to start the server or make database changes.
component_behavior
intermediate
2:00remaining
What is the purpose of the settings.py file inside a Django project?
Inside the main Django project folder, there is a settings.py file. What is its main role?
AIt holds the HTML templates for rendering pages.
BIt contains the URL patterns that map URLs to views.
CIt defines the configuration for the Django project, like database setup, installed apps, and middleware.
DIt manages static files like CSS and JavaScript.
Attempts:
2 left
💡 Hint
Think about where you set your database or add apps in Django.
📝 Syntax
advanced
2:00remaining
What error occurs if urls.py is missing in a Django app?
If you create a new Django app but forget to add a urls.py file and try to include its URLs in the main project, what error will Django raise?
ATypeError: 'NoneType' object is not callable
BTemplateDoesNotExist error
COperationalError related to the database
DModuleNotFoundError: No module named 'app_name.urls'
Attempts:
2 left
💡 Hint
Think about what happens when Django tries to import a missing file.
state_output
advanced
2:00remaining
What is the output of running python manage.py startapp blog?
When you run python manage.py startapp blog in your Django project, what folder structure is created inside the blog app folder?
AOnly a single file named blog.py is created.
BFolders and files: migrations/, admin.py, apps.py, models.py, tests.py, views.py, __init__.py
CA templates/ folder with HTML files is created.
DA static/ folder with CSS and JS files is created.
Attempts:
2 left
💡 Hint
Think about the default files Django creates for a new app.
🧠 Conceptual
expert
2:00remaining
Which folder in a Django project holds the HTML files for rendering views?
In a Django project, where should you place your HTML template files so that Django can find and render them properly?
AInside a <code>templates/</code> folder either at the project level or inside each app folder.
BInside the <code>static/</code> folder alongside CSS and JavaScript files.
CInside the <code>migrations/</code> folder of each app.
DDirectly inside the main project folder with <code>settings.py</code>.
Attempts:
2 left
💡 Hint
Templates are not static files but files used to generate HTML dynamically.