[Answered ]-How to send a notification from django to twisted?

2👍

The Django-ized solution is probably to put an object into settings.py. This is, of course, terrible. However, since Django consistently relies on this piece of global state, to the point where it doesn’t even have any other widely known or used mechanisms for providing state to your application, you may just have to live with it.

You can add something like this to your tac file:

import settings
settings.twisted_listener = your_service

This is not a recommendation so much as a “there’s probably no cleaner ways than this”-ation. In a better world than this one, Django would not have settings.py. It would have APIs that accept arguments for configuring applications.

Leave a comment