title: How to profile a Django custom management command exclusively
body: <p>I would like to profile a custom management command that is relatively CPU intensive (renders an image using PIL). When I use the following command I get all sorts of Django modules (admin, ORM etc) in my profiling results:</p>
  
  <pre><code>python -m cProfile manage.py testrender
  </code></pre>
  
  <p>I have removed all imports that can potentially import Django but I am guessing the following is the culprit:</p>
  
  <pre><code>from django.core.management.base import BaseCommand, CommandError
  </code></pre>
  
  <p>Is there a way to filter out <code>cProfile</code> results? (only filenames are shown, no paths) Or, is there any other way to exclude/include respective modules/packages from profiling?</p>