What is the purpose of the manage.py file in a Django project?
The manage.py file is a command-line utility that helps you interact with your Django project. You use it to run the server, create apps, run migrations, and more.
Click to reveal answer
beginner
What does the settings.py file control in a Django project?
The settings.py file holds all the configuration for your Django project, like database setup, installed apps, middleware, templates, and security settings.
Click to reveal answer
beginner
What is the role of the urls.py file in a Django project?
The urls.py file maps web addresses (URLs) to the code that should run when those addresses are visited. It helps Django know what to show for each page.
Click to reveal answer
intermediate
What is the difference between the project folder and an app folder in Django?
The project folder contains overall settings and configuration for your whole site. An app folder is a smaller part that does one job, like a blog or a shop, and can be reused in other projects.
Click to reveal answer
intermediate
What is the purpose of the wsgi.py file in a Django project?
The wsgi.py file helps your Django project communicate with web servers when you deploy your site live. It acts like a bridge between your code and the internet.
Click to reveal answer
Which file do you use to start the Django development server?
Asettings.py
Bmanage.py
Curls.py
Dwsgi.py
✗ Incorrect
You run commands like python manage.py runserver to start the development server.
Where do you list the apps your Django project uses?
Aurls.py
Bmanage.py
Cwsgi.py
Dsettings.py
✗ Incorrect
The INSTALLED_APPS list in settings.py tells Django which apps are active.
What does the urls.py file mainly do?
AMap URLs to views
BConfigure database settings
CRun server commands
DHandle static files
✗ Incorrect
urls.py connects web addresses to the code that shows pages.
Which folder contains the main settings for the whole Django project?
AProject folder
BApp folder
CStatic folder
DTemplates folder
✗ Incorrect
The project folder holds files like settings.py and urls.py that control the whole site.
What is the role of wsgi.py?
ARun development server
BConfigure database
CBridge between Django and web server
DDefine URL patterns
✗ Incorrect
wsgi.py helps connect your Django app to a web server when deployed.
Explain the main folders and files you find in a new Django project and what each one does.
Think about how Django organizes the whole site versus smaller parts.
You got /4 concepts.
Describe how Django uses the urls.py file to handle web requests.
Imagine URLs as street addresses and urls.py as the map.
You got /3 concepts.
Practice
(1/5)
1. Which file in a Django project is used to run commands like starting the server or creating migrations?
easy
A. manage.py
B. settings.py
C. urls.py
D. wsgi.py
Solution
Step 1: Identify the command runner file
The manage.py file is designed to run commands like starting the server or making migrations.
Step 2: Understand other files' roles
settings.py holds configuration, urls.py routes URLs, and wsgi.py is for deployment interface.
Final Answer:
manage.py -> Option A
Quick Check:
Command runner = manage.py [OK]
Hint: Remember: manage.py runs commands for your project [OK]
Common Mistakes:
Confusing settings.py as command runner
Thinking urls.py runs commands
Assuming wsgi.py runs server commands
2. Which folder typically contains the settings and URL configuration files in a Django project?
easy
A. The app folder
B. The templates folder
C. The project folder
D. The static folder
Solution
Step 1: Identify where settings.py and urls.py live
These files are inside the main project folder, which shares the project name.
Step 2: Differentiate folders
App folders contain app-specific code, templates hold HTML files, static holds CSS/JS/images.
Final Answer:
The project folder -> Option C
Quick Check:
Settings and URLs = project folder [OK]
Hint: Settings and URLs live in the project folder, not apps [OK]
Running manage.py from wrong folder usually gives different error
Forgetting imports in views.py causes different errors
5. You want to create a new Django app called shop inside your project. Which sequence of actions correctly follows Django project structure best practices?
hard
A. Run python manage.py startapp shop, then add shop to INSTALLED_APPS in settings.py
B. Create a folder named shop manually, then add shop to urls.py
C. Add shop to INSTALLED_APPS first, then run python manage.py startapp shop
D. Run python manage.py startproject shop inside your project folder
Solution
Step 1: Create the app properly
Use python manage.py startapp shop to create the app folder with correct files.
Step 2: Register the app in settings
Add shop to INSTALLED_APPS in settings.py so Django knows about it.
Final Answer:
Run startapp then add to INSTALLED_APPS -> Option A
Quick Check:
Start app then register in settings [OK]
Hint: Always start app with manage.py then add to INSTALLED_APPS [OK]