Python starting point

Since I posted the previous post about Django, I was reminded that I wanted to link to a post about setting up a Python project in a sane way. I’ve used this approach for all my little toy projects, and it really works well (particularly using virtualenv).

Mostly, I always have to remember a way to Google for Jeff’s blog, so with any luck posting it here will help me remember.

The cliffnotes are:

  • install virtualenv/set up virtualenv
  • setup Django in the virtualenv
  • start a new Django project
  • set up a new Git repo for the project
  • change the settings to have three sets of installed apps instead of one
  • use fabric for deployment (I haven’t gotten this far yet)

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!