0
0
Djangoframework~10 mins

Installed apps management in Django - Interactive Code Practice

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

Complete the code to add a new app named 'blog' to the installed apps list.

Django
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    [1]
]
Drag options to blanks, or click blank then click option'
A'blog',
B'blog'
Cblog
D'blog.apps.BlogConfig',
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the comma after the app name
Not using quotes around the app name
Using the app name without quotes
2fill in blank
medium

Complete the code to import the settings module in a Django project.

Django
from django.conf import [1]
Drag options to blanks, or click blank then click option'
Aconfig
Bapps
Csettings
Dmodels
Attempts:
3 left
💡 Hint
Common Mistakes
Importing 'config' instead of 'settings'
Trying to import 'apps' or 'models' from django.conf
3fill in blank
hard

Fix the error in the code to check if 'blog' app is installed.

Django
if 'blog' [1] settings.INSTALLED_APPS:
    print('Blog app is installed')
Drag options to blanks, or click blank then click option'
Anot in
Bin
C==
Dis
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' to compare string with list
Using 'is' instead of 'in'
Using 'not in' when checking for presence
4fill in blank
hard

Fill both blanks to add 'blog' app config class to INSTALLED_APPS.

Django
INSTALLED_APPS.append([1])
print([2][-1])
Drag options to blanks, or click blank then click option'
A'blog.apps.BlogConfig'
BINSTALLED_APPS
Csettings.INSTALLED_APPS
D'blog'
Attempts:
3 left
💡 Hint
Common Mistakes
Appending just 'blog' instead of full config path
Printing settings.INSTALLED_APPS instead of INSTALLED_APPS
Using wrong variable names
5fill in blank
hard

Fill all three blanks to create a dictionary of app names and their config classes from INSTALLED_APPS.

Django
app_dict = [1]( (app.split('.')[-1].replace('Config', '').lower(), app) for app in [2] if app.endswith([3]) )
Drag options to blanks, or click blank then click option'
Adict
BINSTALLED_APPS
C'Config'
Dlist
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() instead of dict()
Using wrong variable name instead of INSTALLED_APPS
Not filtering apps by 'Config' suffix