Project & App Structure
Django draws a line between a project (the whole site, its settings, its top-level URL routing) and an app (one self-contained feature — a blog, a store, a polls feature). A project can contain several apps; a well-designed app can even be reused across different projects.
What startproject generates
Running django-admin startproject mysite creates this layout:
mysite/
manage.py
mysite/
__init__.py
settings.py
urls.py
asgi.py
wsgi.py
manage.py is the command-line entry point for everything — running the dev server, creating migrations, opening a Python shell wired up to your project. Inside the inner mysite/ folder, settings.py holds every configuration option (database connection, installed apps, timezone), and urls.py is where URL patterns for the whole project get routed.
Adding an app
A project on its own doesn't do anything yet — you add apps to it. From the same directory as manage.py:
python manage.py startapp blog
blog/
migrations/
__init__.py
__init__.py
admin.py
apps.py
models.py
tests.py
views.pyEach of these files has one job: models.py is where you'll define the app's data (lesson 5), views.py is where request-handling logic goes (next lesson), admin.py registers models with Django's built-in admin (lesson 6), and migrations/ stores the generated history of changes to your models.
Registering the app
Creating an app's folder doesn't automatically activate it — Django needs to be told it exists, in settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog',
]
The six django.contrib.* entries already there are Django's own built-in apps — the admin site, the authentication system, session handling — installed the exact same way your own apps are. Adding 'blog' to this list is what makes its models, admin registrations, and templates visible to the rest of the project.
INSTALLED_APPS but with no models yet does nothing wrong — it's completely normal for a new app to sit empty for a bit while you build it out. What will bite you is forgetting this step entirely: models in an unregistered app silently won't show up in migrations or the admin site, with no error telling you why.