Bird
0
0

You want to deploy your Django app with Gunicorn on a server accessible only on port 8080 and use 4 workers for better performance. Which command correctly achieves this?

hard📝 Application Q15 of 15
Django - Deployment and Production
You want to deploy your Django app with Gunicorn on a server accessible only on port 8080 and use 4 workers for better performance. Which command correctly achieves this?
Agunicorn --workers 4 --bind 0.0.0.0:8080 myproject.wsgi:application
Bgunicorn --workers 4 --bind 127.0.0.1:8080 myproject.wsgi:application
Cgunicorn --workers 1 --bind 0.0.0.0:8080 myproject.wsgi:application
Dgunicorn --bind 0.0.0.0:80 myproject.wsgi:application
Step-by-Step Solution
Solution:
  1. Step 1: Set the correct number of workers

    The requirement is 4 workers, so use --workers 4.
  2. Step 2: Bind to port 8080 on all interfaces

    Binding to 0.0.0.0:8080 makes the app accessible on port 8080 from any network interface.
  3. Step 3: Verify the WSGI application path

    The path myproject.wsgi:application is the correct WSGI app for Django.
  4. Final Answer:

    gunicorn --workers 4 --bind 0.0.0.0:8080 myproject.wsgi:application -> Option A
  5. Quick Check:

    4 workers + bind 0.0.0.0:8080 = gunicorn --workers 4 --bind 0.0.0.0:8080 myproject.wsgi:application [OK]
Quick Trick: Use --workers 4 and bind 0.0.0.0:8080 for access [OK]
Common Mistakes:
MISTAKES
  • Binding only to localhost (127.0.0.1) limits access
  • Using wrong port number
  • Setting wrong number of workers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes