[wingide-users] Importing the Wing Debug only for interactive sessions

Mark Jones mark0978 at gmail.com
Thu Jan 24 22:53:01 EST 2013

Environment variables can be your friend when you don't want things to
happen in productions.  You can put WING_DEBUG into your environment where
you develop.  When you run the process under mod_wsgi, or on a machine you
don't develop on, this won't be in the environment, and you won't import it.

I use this one in my Django settings for every project
  DEBUG = bool(int(os.environ.get('DJANGO_DEBUG', 0)))
and all my working environment define DJANGO_DEBUG=1.  This means things
like runserver/shell (any management command) runs in debug mode, but
production runs automatically default to DEBUG=False

For wingdbstub, you can something like this:

if os.environ["WING_DEBUG"]
  import wingdbstub

However I find that the debugger in wing makes my django app so much slower
that I'm not willing to run with it unless I really need it.  I don't find
the toggling back and forth between debugging/not debugging.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/wingide-users/attachments/20130124/d6cb922c/attachment.html>

More information about the wingide-users mailing list