Django no such table 🐍 Python

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

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

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 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.