0
0
Djangoframework~10 mins

DRF installation and setup 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 install Django REST Framework using pip.

Django
pip install [1]
Drag options to blanks, or click blank then click option'
Adjangorestframework
Bdjango-rest-framework
Crestframework-django
Ddjango_rest_framework
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores or dashes in the package name.
Trying to install a non-existent package.
2fill in blank
medium

Complete the code to add 'rest_framework' to the Django project's installed apps.

Django
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    [1],
]
Drag options to blanks, or click blank then click option'
A'restframework'
B'rest-framework'
C'rest_framework'
D'restframework.apps.RestFrameworkConfig'
Attempts:
3 left
💡 Hint
Common Mistakes
Using dashes instead of underscores.
Using incorrect app names that cause import errors.
3fill in blank
hard

Fix the error in the import statement to use Django REST Framework's routers.

Django
from rest_framework import [1]
Drag options to blanks, or click blank then click option'
Arouters
Bserializers
Cviews
Dmodels
Attempts:
3 left
💡 Hint
Common Mistakes
Importing views or serializers instead of routers.
Trying to import models from rest_framework.
4fill in blank
hard

Fill both blanks to register a viewset with the router.

Django
router = DefaultRouter()
router.[1]('[2]', MyViewSet)
Drag options to blanks, or click blank then click option'
Aregister
Burls
Cviews
Droute
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names like 'route' or 'views'.
Passing a variable instead of a string for the URL prefix.
5fill in blank
hard

Fill all three blanks to include the router URLs in the Django project's URL patterns.

Django
from django.urls import path, include

urlpatterns = [
    path('api/', include(router.[1])),
    path('admin/', admin.[2].[3]),
]
Drag options to blanks, or click blank then click option'
Aurls
Bsite
Dregister
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'register' instead of 'urls' for router URLs.
Using 'admin.site.register' instead of 'admin.site.urls'.