Project structure

Django project structure.

A Django site is one project made of several apps. The project holds the settings and the root URLs; each app holds the models, views and URLs for one area. This page lays out what startproject and startapp create, then shows the djangoproject.com site mapped by Nodeway.

Free to start. macOS (Apple silicon and Intel), Windows and Linux.

The conventional layout

What django-admin startproject mysite and python manage.py startapp polls create:

  • manage.pyThe command line for the project: runserver, migrate, shell.
  • mysite/The project package.
  • settings.pyInstalled apps, database, middleware, templates.
  • urls.pyThe root URL configuration. It includes each app's urls.
  • wsgi.py, asgi.pyEntry points for the web server.
  • polls/An app.
  • models.pyTables, as classes that extend models.Model.
  • views.pyFunctions or classes that turn a request into a response.
  • urls.pyThe app's routes. You add this file yourself.
  • admin.pyRegisters models with the admin site.
  • migrations/Schema changes, made with makemigrations.
  • templates/polls/The app's templates.
  • tests.pyThe app's tests.

How a request finds its code

  • The project's urls.py matches the start of the path and hands the rest to an app's urls.py through include().
  • The app's URL pattern names a view. The view reads and writes models, and renders a template or returns data.
  • Class-based views are routed with as_view(), so the URL pattern names the class and the class picks a method for each HTTP verb.

A real example: djangoproject.com

django/djangoproject.com is the source code of the djangoproject.com website. Nodeway mapped it at commit 2e42ee2, from 24 November 2026. Most of it is Python: 238 files of 254, followed by JavaScript (13) and Shell (3).

Beside the djangoproject package, which holds the settings and the root URLs, it is split into apps such as blog, docs, foundation and members, each in its own top-level folder.

Source files
254
Functions and classes
1,214
Confirmed calls
327
Routes
71
Tables
55

Its folders

  • docs/package29 files15 routes · 2 tables
  • migrations/package8 files
  • management/package5 files
  • sphinx_ext/package2 files
  • templatetags/package2 files
  • djangoproject/package28 files
  • static/js/13 files
  • settings/package5 files
  • urls/package3 files
  • checklists/package22 files3 routes · 7 tables
  • migrations/package14 files
  • templatetags/package2 files
  • aggregator/package21 files8 routes · 4 tables
  • migrations/package7 files
  • management/package4 files
  • foundation/package20 files13 tables
  • migrations/package9 files
  • templatetags/package3 files
  • urls/package2 files
  • blog/package19 files5 routes · 3 tables
  • migrations/package9 files
  • templatetags/package2 files
  • members/package19 files8 routes · 4 tables
  • migrations/package11 files
  • management/commands/1 file
  • releases/package19 files3 routes · 1 table
  • migrations/package5 files
  • management/package3 files
  • templatetags/package3 files
  • fundraising/package16 files7 routes · 5 tables
  • migrations/package3 files
  • templatetags/package2 files
  • dashboard/package14 files5 routes · 6 tables
  • management/package4 files
  • migrations/package3 files
  • tracdb/package13 files2 routes · 9 tables
  • migrations/package4 files
  • accounts/package12 files4 routes · 1 table
  • management/package3 files
  • migrations/package3 files
  • svntogit/package6 files1 route
  • contact/package5 files2 routes

Routes

Nodeway found 71 routes and linked 60 to the function that handles them. They by HTTP method: ANY 70, PATCH 1. Most are under docs (15), aggregator (8) and legacy (8).

Some of them

RouteMethod
/index · dashboard/urls.pyANY
/410gone · legacy/urls.pyANY
/weblogBlogArchiveIndexView · blog/urls.pyANY
/<lang>language · docs/urls.pyANY
/downloadindex · releases/urls.pyANY
/communityindex · aggregator/urls.pyANY
/fundraisingindex · fundraising/urls.pyANY
/accounts/editedit_profile · accounts/urls.pyANY

Data model

Nodeway found 55 database tables, defined with Django ORM. Code in the repository reads or writes 36 of them. The most used:

TableUsed by
releases_release14 columns · releases/models.py12 read40 write
blog_entries13 columns · links to blog_imageupload · blog/models.py3 read27 write
foundation_banner10 columns · foundation/models.py2 read14 write
ticket18 columns · links to component, milestone and version · tracdb/models.py7 read6 write
dashboard_tracticketmetric2 columns · dashboard/models.py4 read5 write
docs_documentrelease4 columns · links to releases_release · docs/models.py5 read3 write
docs_document7 columns · links to docs_documentrelease · docs/models.py5 read2 write
foundation_meeting9 columns · links to foundation_boardmember and foundation_nonboardattendee · foundation/models.py2 read3 write

The full map, with its entry points, a traced request and the most-called code, is on the djangoproject.com architecture page.

See your own project's structure

Nodeway reads a Django project on your own computer and draws its folders, files, functions, routes and tables, with the imports and calls between them. Open a folder and the map is drawn locally; nothing is uploaded. The getting started guide covers installing it, and the repo maps show 31 open-source projects mapped the same way.

Questions

What is the difference between a Django project and an app?

The project is the whole site: its settings, its root URL configuration and its WSGI or ASGI entry. An app is one piece of it, such as a blog or accounts, with its own models, views and URLs. A project lists its apps in INSTALLED_APPS.

Where do templates go in a Django project?

Either inside each app, under templates/<app name>/, or in one templates folder for the whole project named in the TEMPLATES setting. The app name in the path keeps two apps' templates from clashing.

How many apps should a Django project have?

Django sets no number. A common rule of thumb is one app per area you can describe in a sentence, such as a blog or billing; an app that needs two sentences is often two apps.

See your whole codebase in minutes.

Open a folder and Nodeway maps it on your own computer. No account, and nothing is uploaded.

More guides