Complete the code to import the environment variable module.
import os SECRET_KEY = os.environ.get([1])
The os.environ.get function requires the environment variable name as a string, so it must be quoted.
Complete the code to set DEBUG mode from environment variable.
DEBUG = os.environ.get([1], 'False') == 'True'
The environment variable name must be a string, so it needs quotes.
Fix the error in loading ALLOWED_HOSTS from environment variable.
ALLOWED_HOSTS = os.environ.get([1], '').split(',')
The environment variable name must be a string, so it needs quotes.
Fill both blanks to load database settings from environment variables.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ.get([1]),
'USER': os.environ.get([2]),
}
}Common environment variable names for database name and user are 'DB_NAME' and 'DB_USER'.
Fill all three blanks to set email backend settings from environment variables.
EMAIL_BACKEND = os.environ.get([1], 'django.core.mail.backends.smtp.EmailBackend') EMAIL_HOST = os.environ.get([2], 'localhost') EMAIL_PORT = int(os.environ.get([3], '25'))
The environment variables for email backend, host, and port are usually named 'EMAIL_BACKEND', 'EMAIL_HOST', and 'EMAIL_PORT'.