Configuring the database

With all of that philosophy in mind, let's start exploring Django's database layer. First, let's explore the initial configuration that was added to settings.py when we created the application:

# Database 
#  
DATABASES = { 
    'default': { 
        'ENGINE': 'django.db.backends.sqlite3', 
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 
    } 
} 

The default setup is pretty simple. Here's a rundown of each setting.

  • ENGINE: It tells Django which database engine to use. As we are using SQLite in the examples in this book, we will leave it to the default django.db.backends.sqlite3.
  • NAME: It tells Django the name of your database. For example: 'NAME': 'mydb',.

Since we're using SQLite, startproject created a full filesystem path to the database file for ...

Get Mastering Django: Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.