Complete the code to import the module used to access environment variables in Django settings.
import [1]
The os module is used in Django settings to access environment variables with os.environ.
Complete the code to get the secret key from environment variables in Django settings.
SECRET_KEY = os.environ.get([1])The environment variable name is usually SECRET_KEY to store Django's secret key.
Fix the error in the code to safely get an environment variable with a default fallback.
DEBUG = os.environ.get([1], 'False') == 'True'
The environment variable name must be a string, so it needs quotes. The correct name is usually 'DEBUG'.
Fill both blanks to load environment variables from a .env file using python-dotenv in Django.
from dotenv import [1] [2]()
The function load_dotenv() loads environment variables from a .env file. It is imported from dotenv.
Fill all three blanks to create a dictionary of database settings using environment variables in Django.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ.get([1]),
'USER': os.environ.get([2]),
'PASSWORD': os.environ.get([3]),
}
}Common environment variable names for database settings are DB_NAME, DB_USER, and DB_PASSWORD.