Using Signals - request_finished

352 views
Skip to first unread message

Rootz

unread,
Feb 25, 2015, 12:01:24 PM2/25/15
to django...@googlegroups.com
I have tried using the request_finished signal but nothing happens when I tried testing it.
What suggestions or recommendations can I do to help fix the problem?

Thank you.


Below is a sample of the signals.py file (sample is taken from djangoproject.com )

###SIGNALS.PY


from django.core.signals import request_finished


def my_callback(sender, **kwargs):
   
print("request finished")
   
request_finished
.connect(my_callback)



Vijay Khemlani

unread,
Feb 25, 2015, 12:29:57 PM2/25/15
to django...@googlegroups.com
is the signals.py module being loaded at some point?

If it isn't, then the connect function is never being called.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c25adbf7-4654-440f-bb43-9a234339ad17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rodrigo Zayit

unread,
Feb 25, 2015, 12:55:29 PM2/25/15
to django...@googlegroups.com
If it is being loaded and it is not working, try to do by this way:

from django.core.signals import request_finished
from django.dispatch import receiver

@receiver(request_finished)
def request_finished_callback(sender, **kwargs):
    # . . .

Rootz

unread,
Feb 25, 2015, 4:10:41 PM2/25/15
to django...@googlegroups.com
how do I load the signals file at the same point?

Rootz

unread,
Feb 25, 2015, 4:21:34 PM2/25/15
to django...@googlegroups.com
Still not working........

Rodrigo Zayit

unread,
Feb 26, 2015, 5:54:02 AM2/26/15
to django...@googlegroups.com
put on your __init__.py file:

from signals import request_finished_callback

I guess it'll work.


Atenciosamente,
Rodrigo de Oliveira

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.

Rootz

unread,
Feb 26, 2015, 1:02:21 PM2/26/15
to django...@googlegroups.com
thanks it worked....
Reply all
Reply to author
Forward
0 new messages