I need a place to run an initialization code that is application specific (like connecting to signals).
When I put the code to __init__.py
module of an application I've ended up with a circular import of the models.
Is there a way to fire a function when the framework is setup and before any request is executed?
I use quite old version of django 96.6, but I'm also interested in the solutions for the current version.
Regarding the duplication of other questions: Here is how the question differ from the duplicates suggested by S.Lott in comments:
Correct place to put extra startup code in django? Django need to be fully initialized when the function is ran. So code in manage.py won't work.
Where should I place the one-time operation operation in the Django framework? The function initialize the connection between my applications. So the code must be ran in each thread that will actually handle the requests.
Comments to current solutions: I can't use urls as most of my apps don't have any urls exposed. They just listen to signals and store additional information in the database.