How can I access the "uwsgi" module in Python ?

I have noticed that the uwsgidecorators module do import this module, but it cannot be imported from the Python interpreter:

% python

>>> import uwsgi

>>> ImportError: no module named uwsgi

The docs says that "The uWSGI server automagically adds a |uwsgi| module into your Python apps."

What does that mean exactly and how can I access the uwsgi module programmatically?


Thanks,

Etienne


Le 2017-12-07 à 10:13, Etienne Robillard a écrit :
Hi,

I would like to access the uWSGI stats API from within Django by creating a custom WSGI middleware.

Could it be possible to compute the number of requests currently being used by uWSGI workers in Python/Django ?

Ideally, i could then retrieve the active connections in use in a standard Django view:

def someview(request):

    # retrieve the number of active requests (connections)

    connections = request.environ['uwsgi.requests']


What do you think?


Etienne



--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

_______________________________________________
uWSGI mailing list
uWSGI@lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to