开发者

How much do imports slow down Django?

开发者 https://www.devze.com 2023-02-05 09:26 出处:网络
What if I\'m importing 100 things ? (In the top of my views.py) 开发者_如何学编程And then inside each of them, I\'m importing 30 things.

What if I'm importing 100 things ? (In the top of my views.py)

开发者_如何学编程

And then inside each of them, I'm importing 30 things.

Will that slow things down?


It will slow down startup (actually, whatever loads the file containing those imports the first time will be slowed down). Assuming django does not do that for every request but only once, it is not an issue at all.


Only the first time they're imported in the process. After that, all that happens is that a reference is copied to the local scope.

0

精彩评论

暂无评论...
验证码 换一张
取 消