On Thu, Dec 22, 2011 at 3:58 AM, Daniel Sokolowski <[email protected]> wrote: > Dear Django Developers, > > Is there any consensus on where to define your signals for models and > how to import them? I ask because to me it seems very odd that there > doesn't appear to be a standard way to add your own signals and have > them auto imported by the framework. I for example create a / > project_root/project_app/signals.py file and auto import it in the > __init__ of my project app. > > I have read and searched the > https://docs.djangoproject.com/en/dev/topics/signals/ > however it fails short to provide any gudiance on this.
Yes - this is a known problem. The root problem is that there isn't a single reliable place to put "app startup" logic. With the current way Django handles apps, there isn't a single solution that will work everywhere, which one of the reasons that the docs are silent on the issue. The good news is that there is a plan to rectify this -- Arthur Koziel's App Refactor patch, largely created during the 2010 Google Summer of Code, and then polished by Jannis Leidel, provides a generic "entry point" for an app, which would be a suitable place to put logic such as signal registration. The bad news is that the patch has been languishing in need of review for a while. At this point, it almost certainly won't make 1.4; if it can get some attention, it would be a welcome addition to 1.5. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
