Profiling Django webserver for high startup times

2019-03-29 06:24发布

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?

2条回答
beautiful°
2楼-- · 2019-03-29 07:06

While using Vagrant, move virtualenv folder away from /vagrant.

See my answer for similar question.

查看更多
走好不送
3楼-- · 2019-03-29 07:15

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)

查看更多
登录 后发表回答