Bird
0
0

Which of the following is the correct syntax to run a Flask app named app using uWSGI with 4 workers on port 8080?

easy📝 Syntax Q3 of 15
Flask - Deployment
Which of the following is the correct syntax to run a Flask app named app using uWSGI with 4 workers on port 8080?
Auwsgi --http :8080 --wsgi-file app.py --processes 4
Buwsgi --http 8080 --module app:app --workers 4
Cuwsgi --socket 8080 --module app --workers 4
Duwsgi --http :8080 --module app:app --processes 4
Step-by-Step Solution
Solution:
  1. Step 1: Understand uWSGI options

    To run uWSGI with HTTP on port 8080, use --http :8080. The Flask app is specified with --module app:app. Number of workers is set with --processes 4.
  2. Step 2: Eliminate incorrect options

    uwsgi --http :8080 --wsgi-file app.py --processes 4 uses --wsgi-file without --callable app, assuming default 'application' callable instead of 'app'. uwsgi --http 8080 --module app:app --workers 4 uses --workers which is invalid; uWSGI uses --processes. uwsgi --socket 8080 --module app --workers 4 uses --socket without HTTP, which is not the question's requirement.
  3. Final Answer:

    uwsgi --http :8080 --module app:app --processes 4 -> Option D
  4. Quick Check:

    uWSGI HTTP port and workers = --http :port --processes [OK]
Quick Trick: Use --http :port and --processes for uWSGI workers [OK]
Common Mistakes:
MISTAKES
  • Using --workers instead of --processes
  • Omitting colon before port in --http
  • Confusing --wsgi-file with --module

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes