Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to run Gunicorn serving a Django project named myproject.
Django
gunicorn [1].wsgi Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'manage' instead of the project name.
Trying to run Gunicorn without specifying the WSGI module.
✗ Incorrect
Gunicorn runs the WSGI application by pointing to the Django project's wsgi module, which is
myproject.wsgi.2fill in blank
mediumComplete the command to bind Gunicorn to listen on port 8000.
Django
gunicorn myproject.wsgi --bind [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 80 or 443 which require root privileges.
Binding only to localhost which restricts external access.
✗ Incorrect
Binding to
0.0.0.0:8000 makes Gunicorn listen on all network interfaces at port 8000.3fill in blank
hardFix the error in the Gunicorn command to run with 4 worker processes.
Django
gunicorn myproject.wsgi --workers=[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'two' or 'zero' instead of numbers.
Using negative numbers for workers.
✗ Incorrect
The number of workers must be a positive integer without quotes or signs, so
4 is correct.4fill in blank
hardFill both blanks to run Gunicorn with 3 workers and bind to localhost port 9000.
Django
gunicorn myproject.wsgi --workers=[1] --bind [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 4 workers instead of 3.
Binding to 0.0.0.0 instead of localhost.
✗ Incorrect
3 workers is a valid number, and binding to
127.0.0.1:9000 listens on localhost port 9000.5fill in blank
hardFill all three blanks to run Gunicorn with 2 workers, bind to all interfaces on port 8080, and enable access log.
Django
gunicorn [1].wsgi --workers=[2] --bind [3] --access-logfile -
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'manage' instead of the project name.
Binding to wrong IP or port.
Forgetting to specify workers.
✗ Incorrect
The project name is
myproject, workers set to 2, and binding to 0.0.0.0:8080 listens on all interfaces at port 8080. The --access-logfile - option enables access logs to the console.