TIMEX
TIMEX

Reputation: 272432

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?

Upvotes: 3

Views: 339

Answers (2)

ThiefMaster
ThiefMaster

Reputation: 318808

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.

Upvotes: 4

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799560

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.

Upvotes: 3

Related Questions