Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Profiling Django webserver for high startup times

I noted that manage.py runserver takes a lot of time to start the development web server for a Django project I'm working on. I'm wondering if there's a way to understand what part of the startup requires so much resources, being eventually able to collect enough information to fix the problem.

Anyone has an idea about what could I do?

like image 262
Paolo Avatar asked Feb 02 '23 19:02

Paolo


1 Answers

I found an easy and effective solution doing this:

python -m cProfile manage.py runserver > profiled

Further details about Python profilers here (official docs).

I'd also post a link to a video introduction to Python profiling and related tools (PyCon 2009)

like image 141
Paolo Avatar answered Feb 05 '23 08:02

Paolo