Django app loaded?

Is there a way to connect to django app download? I want to be able to execute code when the application is loaded, so that I can, for example, create static variables that will be used later by the application or establish connections to other servers.

The best I've come across is adding the code to the __ init __ file . py ( How do I create a django app scope variable? ) but the problem with this solution is that I want my code to execute after django has finished the startup process and not in the middle / beginning of it.

Another solution I came across is a view that handles this process and then when the application is deployed I issue a request for the url of the view. I don't really like this solution, I prefer it to be part of the app download.

Any ideas on how to do this? Thank;

edit: Apllication refers to the whole django project, not INSTALLED_APPS

+3


source to share


1 answer


There is currently no good way to do this, since Django has no trigger signal. Interestingly, there is a ticket for this , but it is strangely tied to a branch that is being held by another ticket . I'm not sure if Django 1.4 has a blocking feature, but as with the release selection stage, my bet is that it does. So, maybe you can get this in Django 1.5 whenever this happens.



+1


source