title: change python's default traceback behavior include more code from project path?
body: <p>I am running a middle sized django project, whenever a error occurs a traceback is printed, but many functions where Django modules.</p>
  
  <p>But the actual culprit in my own project code, it has only one line, and useful context were hidden because of the traceback depth limit. So I am thinking of  filter the call stack by module path instead of call depth.</p>
  
  <p>In case you haven't seen this problem, I have <a href="https://ptrthomas.files.wordpress.com/2006/06/jtrac-callstack.pdf" rel="nofollow">an very similar example in Java</a>. What I need is to make sure the business logic code shows upfront in an exception.</p>
  
  <p>While I am aware of <code>traceback.print_exc()</code>, but you need to wrap every code in a <code>try ... except</code>.</p>
  
  <p>Is it possible to <strong>change python's default traceback behavior</strong> so django's call stack is fewer and my own code is larger portion?</p>