0

The Django debugger is import pdb; pdb.set_trace().

Sometimes we push the code on the server without remove debugger from the code.

In this conditions when we request the view (that views contain debugger) then the page will not load and the browser will hang because of that debugger.

So my Question is.

Can I set a debugger time

OR

How can I avoid debugger after a few minutes

It's the exception case because we always check in the code but sometimes we missed it by mistake.

How can I achieve this task?

Thanks in advance

Mr Singh
  • 3,936
  • 5
  • 41
  • 60
  • The only reasonable answer is to change your development processes so that you never ship with the debugger enabled - before shipping just do a global search for `import pdb`; or use a IDE/development environment that doesn't need that import in order to run the debugger. – Tony Suffolk 66 Jun 02 '18 at 11:25

1 Answers1

0

If you are using python 3.7+, you can use the builtin function breakpoint(). The specific effect of this function can be modified by setting the environment variable PYTHONBREAKPOINT

The default behaviour of breakpoint() is to use pdb.set_trace(), but you can use a third party debugger instead.

If you set PYTHONBREAKPOINT=0, the debugger() function will not do anything (immediately return)

If you are not using python 3.7, you can check out this question about disabling pdf.set_trace() how to disable pdb.set_trace() without stopping python program and edit the code

Håken Lid
  • 22,318
  • 9
  • 52
  • 67