简体   繁体   中英

How much do imports slow down Django?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM