How To Run Arbitrary Code After Django is “Fully Loaded”

前端 未结 4 1532
失恋的感觉
失恋的感觉 2020-12-17 09:46

I need to perform some fairly simple tasks after my Django environment has been \"fully loaded\".

More specifically I need to do things like Signal.disconnect(

4条回答
  •  死守一世寂寞
    2020-12-17 10:45

    As far as I know there's no such thing as "fully loaded". Plenty of Django functions include import something right in the function. Those imports will only happen if you actually invoke that function. The only way to do what you want would be to explicitly import the things you want to patch (which you should be able to do anywhere) and then patch them. Thereafter any other imports will re-use them.

提交回复
热议问题