Answers: <p>This question doesn't really make sense - WSGI is the mechanism that a web server such as Apache would use to invoke an application or script, such as something written in Python. If you have no web server, then what would be using WSGI in the first place?</p>
  
  <p>Is the question really, how do I take a pre-existing WSGI application and turn it into a standalone? <a href="https://palletsprojects.com/p/flask/" rel="nofollow noreferrer">Flask</a> is one such framework that can run as WSGI or using its own internal web server. </p>
  
  <p>But, taking a step back, I still think this is the wrong question. There is no need to blindly apply the "one process per container philosophy" - which is really just some random person's opinion, at the end of the day - if it doesn't make sense in your use case. Think about it for a second. A container containing one process is just... a process. We already had those. Containers work best for bundling things together that logically belong together and administering them as a single "thing". What's inside them should be completely opaque to who- or whatever is managing them. You will never see developers jumping through hoops to follow a "one shared object per executable philosophy" because that doesn't make sense either!</p>
  
  <p>If you have something that already works well with Apache/Nginx fronting your application, then containerize it that way, it will be fine. </p>
  
Answers: CC BY-SA 4.0
Answers: 2019-10-14T18:39:13.657Z
Answers: putting apache or nginix in the container is not only redundant, it makes the image 2x as big in terms of bits, and makes our Dockerfile much harder to maintain. horrible answer.
Answers: MrCholo
Answers: CC BY-SA 4.0
Answers: 2019-08-26T08:04:24.380Z
Answers: 2019-08-26T08:10:15.567Z
Answers: 2019-08-26T08:10:15.567Z
Answers: Gaius
Body: <p>Is there a way to run a Python server that uses WSGI bindings directly? I am trying to go with the one process per container philosophy which will naturally get rid of Apache/NGINX from the container and just run a python process.
  Is there a way to run python server directly with WSGI bindings without using Apache or NGINX?</p>
  
  <p><a href="https://www.quora.com/unanswered/Is-there-a-way-to-run-a-Python-WSGI-server-directly-without-Apache-or-NGINX" rel="nofollow noreferrer">https://www.quora.com/unanswered/Is-there-a-way-to-run-a-Python-WSGI-server-directly-without-Apache-or-NGINX</a></p>
  
Comments: CC BY-SA 4.0
Comments: 2024-08-23T11:39:52.227Z
Comments: This is perfectly valid question and rationale behind it is clear. 1. Separate processes into containers; 2) Get rid of redundant components.
  Generic answer is NO, though there are lot of caveats. Generally, there are specific WSGI / ASGI servers out there (gunicorn, uWSGI, uvicorn to name a few) and you can run then standalone in a container. But 80% chance you need a reverse proxy in front of it to handle a) load; b) broken and malicious HTTP clients; c) buffer requests / responses; etc
Comments: scorpp
Tags: <python><nginx>
Title: How to run WSGI Python server without Apache or NGINX
UserDisplayName: MrCholo
ThreadText: # How to run WSGI Python server without Apache or NGINX
  
  (Asked by: username_0 on 2019-08-25)
  
  Is there a way to run a Python server that uses WSGI bindings directly? I am trying to go with the one process per container philosophy which will naturally get rid of Apache/NGINX from the container and just run a python process.
  Is there a way to run python server directly with WSGI bindings without using Apache or NGINX?
  
  <https://www.quora.com/unanswered/Is-there-a-way-to-run-a-Python-WSGI-server-directly-without-Apache-or-NGINX>
  
  **Tags:** python, nginx
  
  > **Comments:**
  > **username_1**: This is perfectly valid question and rationale behind it is clear. 1. Separate processes into containers; 2) Get rid of redundant components. Generic answer is NO, though there are lot of caveats. Generally, there are specific WSGI / ASGI servers out there (gunicorn, uWSGI, uvicorn to name a few) and you can run then standalone in a container. But 80% chance you need a reverse proxy in front of it to handle a) load; b) broken and malicious HTTP clients; c) buffer requests / responses; etc  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-08-26. Score: 1
  
  This question doesn't really make sense - WSGI is the mechanism that a web server such as Apache would use to invoke an application or script, such as something written in Python. If you have no web server, then what would be using WSGI in the first place?
  
  Is the question really, how do I take a pre-existing WSGI application and turn it into a standalone? [Flask](https://palletsprojects.com/p/flask/) is one such framework that can run as WSGI or using its own internal web server.
  
  But, taking a step back, I still think this is the wrong question. There is no need to blindly apply the "one process per container philosophy" - which is really just some random person's opinion, at the end of the day - if it doesn't make sense in your use case. Think about it for a second. A container containing one process is just... a process. We already had those. Containers work best for bundling things together that logically belong together and administering them as a single "thing". What's inside them should be completely opaque to who- or whatever is managing them. You will never see developers jumping through hoops to follow a "one shared object per executable philosophy" because that doesn't make sense either!
  
  If you have something that already works well with Apache/Nginx fronting your application, then containerize it that way, it will be fine.
  
  > **Comments:**
  > **username_0**: putting apache or nginix in the container is not only redundant, it makes the image 2x as big in terms of bits, and makes our Dockerfile much harder to maintain. horrible answer.  
  
  ---
  
  