Believe it or not you can debug Django templates with Wing4.0
Posted by Gene at 21:06 on Thu 3 Jun 2010 -- 3 Comments

Wing4.0 is a Django release. Here are the details. You should be able to find out what you need there. So I think I'll just put up some pictures.

Normal view method with a quick test class T to put in the context

Django view method

Awesome!!! Breakpoints in a template.

Django template showing breakpoints

While parked on that breakpoint, use the Debug Probe (pictured) and Call Stack (not pictured)

Wing Debug Probe window

Note the test_func actually was called

The browser rendered template
Tags -
  • With respect: you need THOUSANDS of USD to have breakpoints, simple 100USD is not enough. For THAT money I would prefer to pay Windows Server license for life and have Visual Studio with breakpoints + IronPython + MVC2. That's a joke, I just spent 30 minutes of my life checking this C R A P out and this is basically "disappointing of the decade"

    - Anna
  • Damn it, i was not aware of Wing4 ! This is what i've been looking for.

    - YngwieMalmsteen
  • very awesome

    - Daz
Running Django's 'manage.py test' within WingIDE
Posted by Gene at 12:04 on Wed 14 Apr 2010 -- 1 Comments

One of the powerful features of WingIDE is that you can debug python code, even web applications and Django, with an interactive debugger that is fast and very feature full.

In this article I discuss how I use it with Django. Suppose you have a unit test that hits a relational DB. With Django you can run python manage.py test, to run these tests. When you test this way, Django will do the following

  1. Create a test database, syncdb your tables, and load any data fixtures
  2. Run the tests
  3. Drop the test database

WingIDE has a Unit Testing interface, but it only allows you to run the tests. In other words, it only runs Step 2 above. I have found no easy way to have Wing do Step 1, then run your selected tests within Wing's Testing system, then do Step 3. I'm working on a way to do this, and will blog about it someday. For now, I run the Django Test system through Wing Debug system, and not through the testing system. Like this.

  1. In your Django project, in Wing, Choose to edit the file properties for manage.py.
  2. In the 'Debug' tab of this dialog, and the 'Run Arguments' box type test (and optionally the app name to run tests just for that app).
  3. Now choose to Debug manage.py by right clicking on that file and choosing Debug Selected

This will cause WingIDE to run the Django test framework. Output will go into the Debug I/O panel. Wing will even stop at breakpoints and enter the debugger.

The advantages of this method

The tests can be run either on the commandline or within WingIDE without any changes or hacks to the source and it is simple to set up.

The disadvantages of this method

You don't get to use the rich Wing interface for running tests which would allow you to run individual tests on demand. Beware too that you might be using manage.py to run the Django runserver within WingIDE. That is also configured in the manage.py Debug dialog. You can only configure one argument to manage.py at a time.

  • Debugging unit tests is very useful.
    I do like Wing but Django's integration is too weak. Running tests should be more ergonomic and template tags should be colorized.
    btw thank you for sharing your knowledge :)

    - YngwieMalmsteen