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:
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 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 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 us.
This is it for the default setup – you don’t need to change anything to run the code in this book, I have included this simply to give you an idea of how simple it is to configure databases in Django.