Django and Angular Tutorial

A little while ago, I was trying to build an app using Django on the server side, and some interactive Javascript on the client side. On the surface, it seemed simple, but you end up with this strange disconnect between what you are writing in Python and what you are using in Javascript.

To make matters more complicated, the Javascript is “static” in the Python, and the Python is “static” in the Javascript. What I mean is, you have to build your Javascript independently of the server code, and then go back and deconstruct it to fit in the Django templates.

Needless to say,  I got pretty confused. And my ambition fizzled.

Which is why I was super psyched to see this article about getting Django and Angular.js to communicate with each other. It also helps to see someone list out the concepts as they describe them — I didn’t realize that writing the data out into the HTML document as JSON was called “serializing” for example — but I now know what to Google for.

I want to set up a much simpler version of this, which just takes some data from MySQL, serializes it in Django, loads a Django template and then builds the page with Angular. One dataset, one D3 graphic, stitched together with Angular. Seems like it should be possible with this tutorial!

Leave a Reply

Your email address will not be published. Required fields are marked *