> 2011/7/20 Roberto De Ioris <[email protected]>:
>> Looks like you can make a connection at the startup of your app and
>> reuse it in each requests, but you will need to send a 'keepalive/ping'
>> packet to leave it open.
>
> But how can I access such connection ie. in Django? Best way would be
> to create socket in WSGI file and then have access to it in Django.
> How can I achieve that? I mean that part with accessing it in Django.
> __
in wsgi file:
from uwsgidecorators import *
socketioconnection = None
@postfork
def connect():
socketioconnection = connectxXX
in django view:
# substitute my_wsgi with the name of your module
from my_wsgi import socketioconnection
def index(request):
socketioconnection.send(...)
Thanks to @postfork each worker will get a different object (read:
connection) in socketioconnection
I have not tried it, but should work
--
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi