Recall & Review
beginner
What is the purpose of the
DATABASES setting in Django?The
DATABASES setting tells Django where and how to connect to your database. It includes details like the database engine, name, user, password, host, and port.Click to reveal answer
beginner
Which key in the
DATABASES dictionary specifies the type of database Django will use?The
ENGINE key specifies the database type, such as django.db.backends.sqlite3 for SQLite or django.db.backends.postgresql for PostgreSQL.Click to reveal answer
intermediate
How do you configure Django to use a PostgreSQL database?
You set
ENGINE to django.db.backends.postgresql, then provide NAME, USER, PASSWORD, HOST, and PORT in the DATABASES setting.Click to reveal answer
beginner
Why is it important to keep database credentials secure in Django settings?
Because database credentials give access to your data. If exposed, someone could read, change, or delete your data. Use environment variables or secret managers to keep them safe.
Click to reveal answer
beginner
What happens if you don't configure the
DATABASES setting in Django?Django uses a default SQLite database named
db.sqlite3 in your project folder. This is good for quick tests but not for production apps.Click to reveal answer
Which setting key defines the database type in Django's
DATABASES?✗ Incorrect
The
ENGINE key tells Django which database backend to use.What is the default database engine Django uses if none is configured?
✗ Incorrect
Django defaults to SQLite with a file named
db.sqlite3.Where should you ideally store sensitive database passwords in a Django project?
✗ Incorrect
Environment variables keep secrets out of code and version control.
Which of these is NOT a required key in a Django database configuration?
✗ Incorrect
TEMPLATE is not a standard key in Django's DATABASES setting.To connect Django to a PostgreSQL database, which
ENGINE value should you use?✗ Incorrect
Use
django.db.backends.postgresql for PostgreSQL.Explain how to set up the
DATABASES setting in Django for a new project using SQLite.Think about the simplest database Django uses by default.
You got /4 concepts.
Describe best practices for managing database credentials securely in a Django project.
Consider how to keep secrets safe from others.
You got /4 concepts.