Is anyone using PyScripter
(http://mmm-experts.com/Products.aspx?ProductId=4) as an IDE for
working with Django?
I find it very good for python, but haven't been able to use it to
debug code in my django webapp.
I got pydev running django built-in webserver as an "external tool" but
the breakpoints still don't break, as I expected them to.
any thoughts?
Cheers,
Filipe
at the last of function "def runserver(addr, port):"
replace
" from django.utils import autoreload
autoreload.main(inner_run)
"
with
inner_run()
I made the modification you suggested and started django's webserver as
an external tool in pyscripter, but still couldn't get the debugger to
stop in my breakpoints.
Any other suggestion on how to use breakpoints to debug code in a
Django app?
I would prefer to use PyScripter, but don't mind using any other IDE if
it is integrated with a debugger and works easily with Django.
What IDEs are Django developers using out there?
Thanks in advance,
Filipe
Embarrassingly, I'm using Bluefish. Bluefish is a syntax editor with
broken highlighting. I use it mainly because I've never found the need
for anything more complicated. In general I find it to be quicker to
have a quick read of the documentation, or, as a last resort, ask on
IRC than to debug when using django (javascript is a different story
(mainly since dojo has no documentation).
Good luck finding something that works for you,
Frankie.
>
> Thanks in advance,
> Filipe
>
>
> >
>
Frankie Robertson wrote:
> In general I find it to be quicker to
> have a quick read of the documentation, or, as a last resort, ask on
> IRC than to debug when using django
yeah, but nothing can really replace a debugger for err.. debugging :)
specially when it comes to solving problems that persist even after
reading the docs.
I'm still used to printing vars to the screen (as I used to do in PHP),
but that doesn't seem to be a practical way to solve problems in a
django app (I'd have to change my templates every time I'd need to
print a new var).
To use a proper debugger (with breakpoints and such) seems like the
right way to go, but I haven't add any luck with it so far. I quite
liked debugging from within Pyscripter, but couldn't really make it
work with a django app, so I'm back at the start.
Rephrasing my initial question a bit, can someone advise me on an IDE
in which to build a django app that will allow me to "graphically" use
a debugger? (ie, place breakpoints, inspect values in vars, see the
current execution stack, etc)
Cheers,
Filipe
<snip>
> Rephrasing my initial question a bit, can someone advise me on an
> IDE in which to build a django app that will allow me to
> "graphically" use a debugger? (ie, place breakpoints, inspect
> values in vars, see the current execution stack, etc)
I've found eclipse is pretty good but you need the PyDev plugin
(pydev.sf.net). It uses pylint for reporting syntax errors,
warnings, etc. I haven't found the exact right settings to use for
django though, it complains about something that I know is right
(import error) so I have to setup the PYTHONPATH correctly
probably. I know it has support for debugging, but I personally
cannot vouch for how good it is. I used to hate Eclipse, but I've
actually found using it for python development pretty rewarding,
and the built-in pylint checking has saved me from checking in some
embarassing code inside an exception handler or something. Another
nice thing with Eclipse is that it's cross platform - takes a few
seconds to start up (java you know) but once it's up it's plenty
responsive in my opinion.
FWIW - there's also a commercial plugin built on top of pydev that
I noticed has additional debugging support -
http://www.fabioz.com/pydev/ - never used it though.
Josh
I follow this way:
I really found I don't need a debugger for Django. If I have a
problem, I set some random variable to the data I am interested
in and raise a non-existing exception, like:
bla = user.__dict__
raise Bla
Then I deal with my browser, and the (great!) error page of
Django will tell me all I want to know. If I need more
information, I add more variables like "bla" and hit "refresh" in
the browser. And ... I can experiment with functions in
'manage.py shell'.
Michael
This is great! I'm going to start using this. I normally just use
print and look on the console of the development server.
>
> Michael
>
>
> >
>
That's definitely a better way to inspect values than modifying the
view's template every time I need to debug something. I found out today
that I can also print to the output console (yes, I'm that much of a
newbie :) which also helps.
It doesn't solve everything though, I'd still like to have step by step
execution.
Filipe
>
> Filipe
>
>
> >
>
Simply import pdb and add pdb.set_trace() where you want your first
breakpoint. You can step through after that point and inspect
variables, etc.
http://www.ferg.org/papers/debugging_in_python.html
Don't forget to wrap your breakpoints with "if settings.DEBUG" in case
you forget to remove them when deploying your application.
That's a nice article on how to debug with pdb, thanks. Haven't tried
it with Django though.
What I would really like to have was exactly this, but integrated into
an IDE, and ready to debug a Django app :)
I think I'll keep using PyScripter for now, I hope the "remote
debugger" feature might help debugging Django, when it comes out.
Cheers,
Filipe