Assuming I will use gunicorn to mount a django application:
- How can I bind to both localhost:8000 AND to a unix socket?
- How can I distinguish whether the request (in a view) is coming from the unix socket?
Assuming I will use gunicorn to mount a django application:
You could use something like Gunicorn to listen on both a UNIX socket and a TCP port.
In order to distinguish between the two in your views, I'd simply run two processes - One that listens on the TCP port and one for the UNIX socket. When starting said process, specify an environment variable which you can later access in your view.