Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Profiling Django with PyCharm

My app is pretty slow even in a dev environment so I would like to figure out what's slowing it down so I can try and fix it.

I know about the debug toolbar and according to what it reports neither the database queries nor the downloaded sources are the issue, so it must be the business logic.

However, I cannot run the PyCharm profiler with the Django server because, well, it's not like running a script.

How may I profile Django with PyCharm?

like image 379
dabadaba Avatar asked Sep 29 '16 12:09

dabadaba


1 Answers

You should probably set configuration properly.

enter image description here

Then click on Edit Configurations...

enter image description here

The main thing is to set Interpreter (your virtual environment). You don't have to set Custom Run Command if you use python manage.py runserver

Then you can run Django server directly from PyCharm ann Profiler too.

like image 175
Milano Avatar answered Sep 17 '22 15:09

Milano