Django no such table Python Origin: Application & API Last updated 12 Oct 2026

django.db.utils.OperationalError: no such table: app_model

Django queried a table that hasn’t been created — migrations missing or not applied.

Exact message you may see no such table
Seen on: Python

Meaning

New models need makemigrations + migrate. With SQLite, a different working directory can also point Django at a fresh empty database file.

Common causes

  • makemigrations/migrate not run
  • Migration files not committed
  • Wrong DATABASES path (new empty SQLite file)
  • Tests using a database without migrations

⚡ Quick fix

  1. python manage.py makemigrations && python manage.py migrate
  2. Commit migration files
  3. Use an absolute path for the SQLite NAME (BASE_DIR / "db.sqlite3")

Detailed fix by platform

Python

  1. python manage.py showmigrations lists unapplied migrations

How to diagnose

  1. Table — Which table?
  2. Migrations — Applied on this DB?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

1022 — MySQL ERROR 1022 (23000): Can't write; duplicate key in table (MySQL)10221146 — MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist (MySQL)114642P01 — PostgreSQL: ERROR: relation "x" does not exist (PostgreSQL)42P01ActiveRecord::PendingMigrationError — Rails: ActiveRecord::PendingMigrationError — Migrations are pending. To resolve this issue, run: bin/rails db:migrate (Ruby / Rails)ActiveRecord::Pending…DisallowedHost — django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'x'. You may need to add 'x' to ALLOWED_HOSTS. (Python)DisallowedHostDjango CSRF — Forbidden (403) CSRF verification failed. Request aborted. (Python)Django CSRFImproperlyConfigured — django.core.exceptions.ImproperlyConfigured: settings are not configured / SECRET_KEY must not be empty (Python)ImproperlyConfiguredRoom cannot verify the data integrity — Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number (Android)Room cannot verify th…Django no…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.