Wednesday, January 28, 2015

Reduce start up time for manage.py

Hi,

I'm having a quite large Django project with dozens of apps and many reusable third-party libraries. All the custom management commands (being used with manage.py <command>) take a long time to be executed, since the start up sequence takes between 3 and 5 seconds. Using the cProfile module I was able to see that quite a lot of function calls are executed and it looks like that every app is loaded, including its libraries and such before the actual management command is executed. Is there any common way to speed that up (e.g. by not loading apps/libraries that are not required for a specific management command)? Django 1.7+ is used on Python 3.4.

Output from `python3 -m cProfile manage.py` (truncated): 1100697 function calls (1064507 primitive calls) in 5.172 seconds

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/db49c215-ac1d-4465-a911-f50d16c6dfab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment