[wingide-users] auto restart for django

Chris Curvey chris at chriscurvey.com
Thu Jan 24 10:06:22 EST 2013

On Thu, Jan 24, 2013 at 9:55 AM, Wingware Support <support at wingware.com>wrote:

> brian downing wrote:
>> I noticed in the django doc it has a section “Debugging with
>> Auto-reload”. Is there a way I can avoid adding “import wingdbstub” to
>> every file? I don't want to have to edit this out for production and I
>> don't know which file is the problem till I start debugging.
>> Currently while I'm in writing/testing mode I run the django server stand
>> alone so I don't have to keep restarting the debugger. If I need the
>> debugger, I'll stop the stand alone server and launch within wing so I can
>> use the debugger. I was hoping there was a better way than switching
>> between command line server and the wingware debugger.
> The 'import wingdbstub' can be anywhere and debugging continues for the
> life of the process or until the IDE disconnects or you use the debugging
> API to stop debugging. You could either put it in the Django code that runs
> early when starting the server, so it gets run whenever Django restarts for
> reload, or you could put it somewhere that you can invoke on demand to
> start debugging (such as a page handler for a special start_debug page you
> can load in your browser). I'd recommend the first of these two options, so
> you are always running under the debugger while developing and debugging
> sets itself up automatically after each auto-reload.
> +1 on that.  I just wrap it up in a try/except block so I don't have to
worry about it in production.  I think I have gone so far as to put the
import in settings.py

  import wingdbstub
except ImportError:

Another alternative is to actually have the wingdbstub.py file in
production, but set the kWingDebugDisabled = 1 so that debugging is
ignored.  I've found that having this infrastructure around in production
can be really helpful when I have an urgent problem in production that I
can't duplicate on my machine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/wingide-users/attachments/20130124/5f09fb52/attachment.html>

More information about the wingide-users mailing list