13

Is there a command line tool to send requests directly to a wsgi application (django) listening on a unix socket?

An equivalent of:

curl -X GET http://example.org/index.html

But that would bypass HTTP server and talked directly to the underlying application over wsgi?

Jan Wrobel
  • 6,969
  • 3
  • 37
  • 53

3 Answers3

1

I think you're looking for uwsgi_curl as described in this answer.

giorgiosironi
  • 1,077
  • 1
  • 11
  • 18
0

The Django application listening on the unix socket uses a different protocol than HTTP, most probably FastCGI. So you cannot use an HTTP client to talk directly with it.

Here you can find an article showing how to use a command line program called cgi-fcgi to talk directly with your application. The article uses Php-fpm, but the concept is the same.

http://www.thatsgeeky.com/2012/02/directly-connecting-to-php-fpm/

Augusto Destrero
  • 4,095
  • 1
  • 23
  • 25
  • There are possibly certain modes of uWSGI which allow it to listen for HTTP requests over a UNIX socket. I suspect certain over WSGI hosting solutions offer something similar as well. OP needs to state what they are using to host it and setup the scenario where they have it listening to a UNIX socket. – Graham Dumpleton Jul 08 '13 at 13:58
  • 1
    As far as I know, WSGI applications expect the [WSGI protocol](https://www.python.org/dev/peps/pep-3333/), not FastCGI – giorgiosironi Feb 15 '18 at 14:43
0

Django test module has a Client that can talk to a wsgi/asgi application. You can probably use this in a REPL python session for instance.

Cyrille Pontvieux
  • 2,356
  • 1
  • 21
  • 29