On Friday, December 17, 2010 10:00:55 AM UTC+11, dmitry b wrote:
>
> Hi, What is the best place to register a signal handler so that the 
> registration happens when the app is first initialized into django? I have 
> an app that needs to listen to signals generated by another app and fire off 
> celery tasks in response. I've tried placing the registration code into the 
> app's __init__.py, but since I have other reusable code there, doing so 
> created cyclical references when importing modules. Is there another 
> location within the app's code that is guaranteed to be picked up when 
> django is being initialized (like an django app level init rather than 
> python level module init)? Thanks Dmitry


Are you talking about UNIX process signals?

If you are then you will have a problem with portability of your 
application. This is because UNIX process signals are usually the domain of 
the hosting environment in which you are deploying your Python web 
application. For that reason, under Apache/mod_wsgi you will be blocked from 
registering your own UNIX signal handlers so as to avoid problems with your 
signal handler registrations interfering with the hosting environments own 
use of signals to manage its processes. You can in the case of 
Apache/mod_wsgi override this so you can do what you want, but you do risk 
causing problems or preventing certain features of the web hosting 
environment from working properly.

I would strongly suggest you find an alternate way of doing things if you 
are considering using UNIX process signals.

Graham

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to