Entries tagged with django

Using ipython's debugger as pdb replacement.

22. July 2010 - view comments

Do you know how to debug your python code? I usually do the following in my code to set something like a hardcoded breakpoint:

import pdb; pdb.set_trace();

This will bring up a pdb prompt when the code execution reaches this line. But pdb is a bit limited since it doesn't support code completion, syntax highlighting and so on.

So here is how you make your debug prompt more fancy by using ipython's debugger.

read more.

Websocket support for django!

20. July 2010 - view comments

You know what WebSockets are? It's a new web protocol for bidirectional connections between the browser and your application server. This is a huge win over AJAX and plain HTTP since you don't need to establish a new connection for every tiny message.

Like TCP socket but for the web.

It's an exciting new technology - so I started experimenting with WebSockets and with my favourite webframework Django. Here is what I came up with, bundled into a reusable app called django-websocket.

read more.

Enable setup.py test in your Django apps

17. July 2010 - view comments

Erich Holscher has posted a blog entry with the same title about a year ago. This helped me out quite a lot to get python setup.py test working with a reusable app.

Unfortunatelly the code in his blog post is not working anymore exactly like this. Django has changed its internal structure of its default test runner. So here is how you can get setup.py test working today.

read more.

Django admin with read-only permission

1. July 2010 - view comments

I work as a freelancer and do many django related projects. My clients care in most cases very much about django's admin site and want to have it customized in many different ways.

One client even has a django project that uses the admin site as only frontend. It's an intranet CRM system - but they need to assigned every employee change permissions because every user must be able to view every entry.

Since django doesn't support read permissions in the admin this was the only way to do it. Here is a quick-and-dirty fix without creating extra views for readonly pages, extra templates etc.

read more.

Test Driven Development - The Django Way

10. March 2010 - view comments

Integrate your python test runner into vim

6. March 2010 - view comments

I've lately browsed the dotfiles repository of Gary Bernhardt and found a wonderful gem in his .vimrc. He has implemented some clever functions that run your testsuite and shows you a pretty, colorful bar below your statusline to indicate if all tests have passed or if some of them have failed.

If your tests are passing, it shows you a bright green bar to visualize that everything went well. If some test are failing your quickfix list is populated with all failing assertions and your cursor jumps to the first one.

I adapted his implementation and changed some points to make it fit for my work with django. The code can find out to which app the file you are editing belongs to and only runs tests for this particular application.

read more.

Testing your first django app

20. January 2010 - view comments

Benchmark of django deployment techniques

20. January 2010 - view comments

Introducing django-publicmanager

5. January 2010 - view comments

I use nearly in all projects something like an is_public and a pub_date field in my models. But using this introduces many possibilities to forget to check this values in all places you use the model which would open up everything for information leaks.

django-publicmanager tries to fix this issue with two custom managers.

read more.

Modelvalidation will be in django 1.2

5. January 2010 - view comments

Released django-feedburner

4. January 2010 - view comments

I stumbled upon a stackoverflow question that asks about feedburner integration into a django app. django-feedburner is my attempt to bundle this into a reusable app.

read more.

Hello world!

3. January 2010 - view comments

I already thought about creating my own blog about two years ago. But I always wanted too much and never finished any approach I started with. So I tried something different this time - I have mainly used ready to use django components and finished this site in about three days.

Read what I want to publish on this blog in the next few months.

read more.