Search code examples
djangoperformanceprofilingwebserverstartup

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?


Solution

  • 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)