0
0
Djangoframework~10 mins

Why production setup differs in Django - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set DEBUG mode off for production.

Django
DEBUG = [1]
Drag options to blanks, or click blank then click option'
ATrue
B"False"
CNone
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Setting DEBUG to True in production exposes sensitive info.
2fill in blank
medium

Complete the code to add allowed hosts for production.

Django
ALLOWED_HOSTS = [[1]]
Drag options to blanks, or click blank then click option'
A"example.com"
B"localhost"
C"127.0.0.1"
D"*"
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' allows all hosts, which is insecure in production.
3fill in blank
hard

Fix the error in the static files setting for production.

Django
STATIC_ROOT = [1]
Drag options to blanks, or click blank then click option'
Aos.path.join(BASE_DIR, 'static')
Bos.path.join(BASE_DIR, 'staticfiles')
CBASE_DIR + '/static/'
D'/static/'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting STATIC_ROOT to the same folder as STATICFILES_DIRS causes conflicts.
4fill in blank
hard

Fill both blanks to configure secure cookies in production.

Django
SESSION_COOKIE_SECURE = [1]
CSRF_COOKIE_SECURE = [2]
Drag options to blanks, or click blank then click option'
ATrue
BFalse
C"True"
D"False"
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving these as False exposes cookies over insecure connections.
5fill in blank
hard

Fill all three blanks to configure database settings for production.

Django
DATABASES = {
    'default': {
        'ENGINE': [1],
        'NAME': [2],
        'USER': [3]
    }
}
Drag options to blanks, or click blank then click option'
A'django.db.backends.postgresql'
B'mydatabase'
C'myuser'
D'sqlite3'
Attempts:
3 left
💡 Hint
Common Mistakes
Using SQLite in production is not recommended for scalability.