DevPath icon indicating copy to clipboard operation
DevPath copied to clipboard

[Feature]: Replace the Werkzeug development server with Gunicorn for live deployment

Open shouryaawr opened this issue 6 months ago • 5 comments

What problem does this solve?

The current Docker configuration runs the app using CMD ["python", "app.py"]. This starts Flask’s built-in Werkzeug development server, which isn't safe or efficient for production. As the Flask docs warn, the dev server lacks the concurrency, stability, and scaling capabilities needed to handle real-world traffic. Leaving it active limits performance and creates unnecessary security risks.

Proposed solution

I propose switching the container to use Gunicorn as our WSGI server. This involves two steps:Add Gunicorn: Add gunicorn==23.0.0 to requirements.txt.Update the Dockerfile: Change the CMD instruction to use Gunicorn with multiple workers and threads to handle traffic efficiently:

CMD ["gunicorn", "--workers", "4", "--threads", "2", "--bind", "0.0.0.0:5000", "app:app"]

Alternatives considered

-Leaving the server as it is: keeps the development server active, which violates deployment best practices and triggers a "Do not use in production" log warning. -Using uWSGI: a good alternative, but requires C-compiler dependencies that slow down the Docker build process. Gunicorn is a cleaner choice because it installs instantly via pip and works perfectly with our python:3.9 - slim base image.

Which part of the app does this affect?

Other

Estimated complexity

Medium (one function and one template change)

Before submitting

  • [x] I searched existing issues and this has not been requested before.
  • [x] This change would benefit contributors beyond my own use case.

shouryaawr avatar Jun 02 '26 21:06 shouryaawr

Thank you for opening your first issue in DevPath.

Please make sure to:

  • Read CONTRIBUTING.md
  • Wait for assignment before starting work
  • Follow repository guidelines carefully

Happy contributing.

github-actions[bot] avatar Jun 02 '26 21:06 github-actions[bot]

hi @komalharshita , I'm a GSSoC'26 contributor and I would like to work on this issue i created. Please assign it to me.

shouryaawr avatar Jun 02 '26 21:06 shouryaawr

hi @komalharshita , I would like to work on this issue under gssoc. Please assign it to me. /assign

YLaxmikanth avatar Jun 03 '26 00:06 YLaxmikanth

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

github-actions[bot] avatar Nov 19 '26 08:11 github-actions[bot]

This issue was closed because it has been inactive for an extended period. If this issue is still relevant, feel free to reopen it or create a new one.

github-actions[bot] avatar Nov 26 '26 09:11 github-actions[bot]