Using Cairo to generate SVG in Django

Posted by stu at February 3rd, 2010

Cairo is a 2D vector graphics api used by Firefox, Gtk and other desktop projects.

I’m going to show here that it can also be used to generate web content, using Django.

I’m going to port two examples from the Michael Urmans Cairo Tutorial for PyGTK Programmers.

To understand the cairo and it’s drawing model I’d recommend his his Cairo Tutorial for Python Programmers.

Note: In this example I’ll be generating SVGs…  as I.E. (as of 2010) does not support them, you might want to generate PNG or PDF – if you need to do this with cairo, look for one of the many cairo tutorials on the web.

The example django project can be downloaded at the end of the article.

(more…)

Posted in projects, web| 6 Comments | 

5 Minute python

Posted by stu at February 26th, 2008

I’ve recently been learning python and decided to note down the *very basics* that took longer to find out than I would’ve liked.

Without furtherado, heres my 5-minute-python.

Posted in projects| 5 Comments |