0
0
Djangoframework~10 mins

Docker containerization 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 specify the base image in a Dockerfile for a Django app.

Django
FROM [1]
Drag options to blanks, or click blank then click option'
Apython:3.12-slim
Bnode:latest
Cubuntu:20.04
Dnginx:alpine
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a Node.js or Nginx image which are not for Python apps.
Using a full Ubuntu image which is larger and less specific.
2fill in blank
medium

Complete the command to install Django inside the Docker container.

Django
RUN pip install [1]
Drag options to blanks, or click blank then click option'
Anumpy
Bflask
Crequests
Ddjango
Attempts:
3 left
💡 Hint
Common Mistakes
Installing Flask instead of Django.
Installing unrelated packages like requests or numpy.
3fill in blank
hard

Fix the error in the Dockerfile command to copy the project files.

Django
COPY [1] /app/
Drag options to blanks, or click blank then click option'
Arequirements.txt
Bsrc
C.
DDockerfile
Attempts:
3 left
💡 Hint
Common Mistakes
Copying only requirements.txt or Dockerfile which misses other files.
Copying a folder named src which may not exist.
4fill in blank
hard

Fill both blanks to expose the Django default port and set the working directory.

Django
EXPOSE [1]
WORKDIR [2]
Drag options to blanks, or click blank then click option'
A8000
B/app
C/usr/src/app
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Exposing port 8080 which is not Django's default.
Setting working directory to a path not used in the Dockerfile.
5fill in blank
hard

Fill all three blanks to run the Django development server with correct options.

Django
CMD ["python", "[1]", "[2]", "0.0.0.0:[3]"]
Drag options to blanks, or click blank then click option'
Apython
Bmanage.py
C8000
Drunserver
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'runserver' as the first argument instead of 'python'.
Using port 8080 instead of 8000.
Omitting 'manage.py' which is required to run Django commands.