Hello, my name is Joshua Inkenbrandt and I live in Kansas City, Missouri with my wife and two kids. I'm a Mac guy. I'm a Python guy.

My goal is to make cool stuff that's fun and easy to use.

Only showing Posts with tag django X

January 24, 2010

Do You Really Need All That Session Data?

When I started web development in 2003 I was using PHP4 as my language of choice. In PHP4, sessions were a built-in feature where the mechanics were somewhat hidden from you. You could initialize a session by calling a function (session_start) and then you would have access to the aptly named $_SESSION variable, which was simply - for all intents and purposes - an associative array.

When I moved on to the world of Python and Django, I carried over the mindset that a session needed to be a hash that I could use to store all kinds of important data. As it turns out, though, all I was really storing was the user's name or their email or something of that nature; nothing that required the use of a database.

So the overhead that I was incurring to store a user's session data in a database and retrieve it every time they made a request was absurd. Now I'm not saying you should never do that, I'm simply saying that if it's not a necessity to store more than the user's name, why not just use a signed cookie? For simple authentication or tracking, using a signed cookie can save you unnecessary hits to your database.

Just my two cents.

January 21, 2010

First Impressions of Tornado

I created this site using Tornado because I wanted a simple site that was fast and efficient. Tornado offers just that. From request handling to template rendering it's extremely fast. The development time and learning curve was on par with something like web.py or Google's App Engine. Tornado's documentation, though not very thorough, will give you what you need to get started. For any other questions you might have, you can usually just figure it out by reading through the source code. All in all, I'm very pleased with the functionality and performance that Tornando offers. I'm really looking forward to working with it in the future.

Along with Tornado, I thought I'd try out SQLAlchemy for my ORM. I've always used Django's or App Engine's models. And as it turns out, I like SQLAlchemy very much.