SQLite as the Default Database
Where the Database Lives
A freshly created Django project stores its SQLite database as a single file named db.sqlite3 sitting right next to manage.py in the project's root folder.
Example: Where the Database Lives
Running migrate the first time creates db.sqlite3 right next to manage.py — ls afterward confirms the file now exists.
python manage.py migrate
ls db.sqlite3
⚠️ Run this command in your terminal.
No Server to Install
Unlike PostgreSQL or MySQL, SQLite doesn't run as a separate background process — Django's database driver reads and writes the file directly, so there's no server to start or configure.
Note: This is exactly why SQLite is the default for new projects: it works immediately with zero setup.
Example: No Server to Install
Running migrate for the first time both creates the db.sqlite3 file and fills it with Django's built-in tables — no separate installation step required.
python manage.py migrate
# creates db.sqlite3 automatically if it doesn't exist yet
⚠️ Run this command in your terminal.
When to Move Beyond SQLite
SQLite handles one writer at a time well, which is fine for development and small sites, but a busier production site with many simultaneous users usually switches to PostgreSQL for better concurrent write performance.
Warning: Never assume SQLite scales the same way a dedicated database server does under heavy concurrent traffic.
Example: When to Move Beyond SQLite
This is the exact DATABASES setting a new Django project ships with — nothing needs to be added for SQLite to work.
# settings.py excerpt using SQLite (the default)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
{# Django-only code -- models.py/views.py/urls.py/settings.py
snippets, or template markup using Django template tags/variables
-- can't run standalone via Judge0 or the browser preview, since
it needs a real Django project. Only this course's pure-Python
examples (example_lang == 'python', no Django imports) are
actually runnable, so those still get the button below. #}
- Assuming SQLite is only good for testing and can never be used in any real deployment, when it's actually fine for many small, low-traffic sites.
- Deleting the db.sqlite3 file to reset the app without realizing this permanently destroys every row of real data in it.
- Trying to access the same SQLite file from multiple servers at once, which SQLite isn't designed to handle well under heavy concurrent writes.
- SQLite stores the entire database in one file, usually db.sqlite3.
- It requires no separate database server — Django talks to the file directly.
- It's the default ENGINE in a new project's settings.py, ready to use immediately.
- It's great for learning and small projects, but larger production apps often move to PostgreSQL.
Chapter Quiz — Complete all 8 topics to unlock
0/8 topics done
Complete these topics first: