[Django]-Debugging django signals' problems

6👍

Make sure that the code that connects to the signal and the code that sends signals both import the with the same path. For example, if you connect a signal with:

from myapp.registration.signals import user_registered
user_registered.connect(...)

Then later when you send this signal you must import it with

from myapp.registration.signals import user_registered

(notice the myapp.) and not:

from registration.signals import user_registered

otherwise they’ll be treated as two different signals.

0👍

Did you try to put user_registered.connect(user_created) in regbackend.py (and not in urls.py) as shown in the example you linked?

You can find some additional info on where to best connect your signals in this question.

To see if user_registered is called correctly you simply could add a debug call at the beginning of the user_created function.

django-debug-toolbar, though i haven’t used that specific feature, might be another option:

Currently, the following panels have
been written and are working:

  • List of signals, their args and receivers
👤arie

0👍

I created a sample application, that you can play with (I believe it works)
http://dmitko.ru/samples/sample_user_registration.zip

👤dmitko

Leave a comment