Can't debug Django app but run success

Hi, I have problem that can't debug Django project but cat run success.

In debug mode, I set breakpoints, the Django project can run and jump over the breakpoints not pause at breakpoints.

I can debug a single python file successful, but just Django project can't debug . And there with any exception

 

 

This is a part of my Django code, as you can see, I print  * is working, but breakpoint I set is not working that jump over the breakpoints

print('*' * 100)

 

 

This is my Django Debug Configurations, set PYCHARM_DEBUG= True

 

 

While I debug a signal python file, the debug is working normal

 

My Pycharm version:

 Can you help me to solve this problem? thank you!

0

Hi, 

Please check if the issue is reproduced in PyCharm 2022.1 (https://www.jetbrains.com/pycharm/download/)

If it does, please check if the issue is reproduced in another simple Django project. You can use my test project for this -- https://github.com/aresler/django_dbg_test

0

I have the same problem

I found that as long as the package name is "django", this problem occurs

0

I understand the problem is already old, but I just encountered a similar case, so I'll tell you about it.

The thing is, the PyCharm debugger uses the sys.settrace function to set its own tracing function, so if you have a process that has already captured this API, the debugger does not stop at breakpoints during program execution.

The well-known case is the pytest-coverage module, but I came across another one.

I enabled the django-debug-toolbar-line-profiling module, which similarly captured sys.settrace and displaced the debugger.

So, if your debugger stopped working somewhere, think about which modules might be setting their own tracing function.

0

请先登录再写评论。