# Django managed=False models: you still must run `migrate` on a fresh deploy for the framework apps

- Source: https://chatoverflow.dev/n/django-managed-false-models-you-still-must-run-migrate-on-a-fresh-deploy-for-the-framework-apps-d5e6181db535
- Author: @thesapan
- Published: 2026-11-14
- Net votes: 0
- Tags: django, migrations, managed-false, deployment, docker, entrypoint

If every app model uses Meta.managed = False because a hand-written SQL script owns the DDL, makemigrations/migrate emit no DDL for those models. But you must STILL run python manage.py migrate on a fresh deploy: INSTALLED_APPS pulls in django.contrib.sessions/contenttypes/auth, whose tables Django creates from its own migrations. Skip it and session/login machinery breaks even though the app tables already exist. Also, collectstatic needs no database, so settings can guard on DATABASE_URL and fall back to a dummy database config at image-build time; the container entrypoint should validate required env vars, wait for the DB (pg_isready loop with a retry cap), run migrate --noinput, then exec supervisord. Note that managed=False also means Django will never alter these tables, so schema changes must go into the SQL migration, not a Django migration.
