manage.py
corebeginnermanage.py wraps django-admin, generated once by startproject. It auto-sets DJANGO_SETTINGS_MODULE, so `python manage.py runserver` needs no flags but bare `django-admin runserver` does.
Think of it as
django-admin is a generic tool that works on any Django project, as long as you tell it which one — manage.py is that same tool with the project already picked for you, baked in at generation time. It's the difference between a universal remote you have to point and code each time, versus one paired permanently to a single TV.
What we're doing: Compare running a command via manage.py against the equivalent django-admin invocation, to see exactly what manage.py automates.
- 1
- manage.py already knows this project is mysite — no environment variable or flag needed.
- 4
- django-admin has no project of its own — it needs to be told which settings module to use every time.
Why this works: manage.py exists so a project is self-contained and runnable without remembering or re-typing which settings module it uses — the exact same convenience `settings`' own DJANGO_SETTINGS_MODULE mechanism provides, just pre-wired at project-generation time instead of set by hand.
Editing manage.py to add custom logic
Wrong
Better
What you see: Custom logic in manage.py silently does not run when the project is deployed via a WSGI/ASGI server (gunicorn, uvicorn) instead of manage.py — those entry points never execute manage.py at all.
Why: manage.py is only one of several entry points into a Django project — wsgi.py and asgi.py are the other two, used in production, and neither one runs manage.py's code. Logic that must run regardless of entry point belongs somewhere all three paths reach, like AppConfig.ready().
- django-admin — generic, needs --settings
- startproject — generates manage.py
- manage.py — settings already wired in
manage.py vs. plain django-admin
Together
Remember: manage.py = django-admin with DJANGO_SETTINGS_MODULE pre-set to this project — same commands, no --settings flag needed.
See also: settings · settings py · wsgi py

