Open Django’s db.sqlite3 on Mac

Django projects often use a file named db.sqlite3 for local development. Confirm the configured database path before opening it: a different settings module can point somewhere else entirely.

Find the database Django actually uses

Check DATABASES in your project’s settings. For SQLite, ENGINE is django.db.backends.sqlite3, and NAME is the file path. A common configuration is BASE_DIR / "db.sqlite3". Environment-specific settings may override it.

From the project directory, with the project’s environment active, print only the engine and database name:

python manage.py shell -c "from django.conf import settings; print(settings.DATABASES['default']['ENGINE']); print(settings.DATABASES['default']['NAME'])"

If the engine is PostgreSQL or MySQL, there is no corresponding local SQLite file to open. See Django’s DATABASES reference.

Inspect it from Terminal

sqlite3 -readonly "/absolute/path/to/db.sqlite3"
.tables
.schema django_migrations
SELECT app, name FROM django_migrations LIMIT 20;
.quit

The migrations table exists after migrations have created it. Replace the example query with a table from .tables if needed. A plain sqlite3 db.sqlite3 connection can create an empty file in the wrong working directory; -readonly avoids that trap.

Django’s dbshell command also opens the configured database, but it is not a read-only inspection guarantee.

View tables in Petti

Open that same file in Petti and choose a table. Use the grid for records, Structure for columns, and search or filters to narrow results. Petti starts read-only, so routine inspection does not require unlocking.

Use Django for application changes

Direct database edits bypass model validation, signals and other application behavior. Do not “fix” migration history by casually editing django_migrations. Use Django migrations for schema changes and the ORM or management commands for application-aware updates.

For production data, use your normal authorized backup and maintenance workflow. If a development server or worker is writing concurrently, lock errors are possible. When taking a copy, account for WAL files.