CodeVetter · Repo Unpack · System map
django/django
The installable product is the django package (setuptools include django*). Process entrypoints are the django-admin console script, python -m django, and the WSGI/ASGI factories. django.setup() is the shared bootstrap: logging, script prefix, then Apps.populate. Settings are a lazy proxy. Persistence is a ConnectionHandler over pluggable database backends, with sqlite3, postgresql, mysql, oracle, and a dummy engine in-tree. There is no application server to deploy from this repo; deployment shape is a generated project plus an external WSGI/ASGI server. Tests and docs are developer-only surfaces driven by tests/runtests.py, tox.ini, and GitHub Actions.
- django/__init__.py sets VERSION to VersionTuple(6, 2, 0, 'alpha', 0) and setup() calls configure_logging, optionally set_script_prefix from FORCE_SCRIPT_NAME, then apps.populate(settings.INSTALLED_APPS).
- pyproject.toml names the project Django, requires Python >= 3.12, depends on asgiref>=3.12.1 and sqlparse>=0.5.0 (tzdata on Windows), and exposes console script django-admin = django.core.management:execute_from_command_line. Optional extras are argon2 (argon2-cffi) and bcrypt.
- python -m django delegates to management.execute_from_command_line() in django/__main__.py. ManagementUtility.execute parses --settings and --pythonpath first, calls django.setup() unless the runserver autoreloader path already did, then fetch_command(subcommand).run_from_argv.
- get_wsgi_application() and get_asgi_application() both call django.setup(set_prefix=False) and return WSGIHandler or ASGIHandler. The handlers are intentionally not the public API.
- LazySettings loads the module named by environment variable DJANGO_SETTINGS_MODULE (ENVIRONMENT_VARIABLE) and raises ImproperlyConfigured if it is unset and settings were not configured manually. User settings overlay django.conf.global_settings.
- Apps.populate is thread-safe and idempotent but not reentrant. It imports AppConfig entries, import_models on each, then calls AppConfig.ready() before setting apps.ready and ready_event.
- django.db.connections is a ConnectionHandler; connection is a ConnectionProxy for the default alias; router is a ConnectionRouter. request_started resets query logs and closes unusable connections; request_finished closes them again.
- Database engines shipped in-tree are django.db.backends.sqlite3, postgresql, mysql, oracle, and dummy. An empty DATABASES ENGINE uses the dummy backend, whose operations raise ImproperlyConfigured. The startproject template sets ENGINE to sqlite3 and NAME to BASE_DIR/db.sqlite3.
- Core management commands are discovered by find_commands via pkgutil.iter_modules on management/commands, mapped by get_commands() (functools.cache) as name -> app. Installed apps override core names because their configs are applied in reverse.
- Built-in command modules include check, dbshell, dumpdata, loaddata, makemigrations, migrate, optimizemigration, runserver, shell, squashmigrations, startapp, startproject, test, and testserver, among others under django/core/management/commands/.
- Default cache backend is django.core.cache.backends.locmem.LocMemCache via CACHES['default']. CacheHandler reads settings.CACHES the same way TaskBackendHandler reads settings.TASKS.
- tox.ini envlist is py3, black, blacken-docs, flake8, docs, isort, lint-docs, and zizmor. The py3 env installs the repo editable, installs tests/requirements/py3.txt, cds to tests, and runs runtests.py. GitHub Actions workflow Tests runs that suite on SQLite for CPython 3.14 (Windows) and free-threaded 3.14t (Ubuntu).
- Documentation is reStructuredText under docs/ (Sphinx). tox docs runs make spelling; lint-docs runs make lint. README.rst points readers at docs/intro/install.txt, the tutorials, and docs/howto/deployment/index.txt rather than a server in this repo.