When they came out, i was excited. I really enjoyed the added functionality that models and forms had implemented using class like interfaces. Turns out, class based views weren't as loved by the lot. By the time I realised this I had already jumped into learning and using them. Several blogposts have been made, reviews written, tears shed, pain shared, guilt exposed and then, the dust has covered them. People have come to terms with their views, functional, or class-based.
I for one choose to use them. Because I like them. I like writing classes. A quality that has stuck, since my C++ days in college. At first, I decided to write this article in adamant defense of what I have begun to depend on more and more (I know almost the entire codebase of class-based views), but then I realised that I couldn't honestly do that, simply because, I had to know almost the entire codebase of class-based views to use them to their fullest. Therefore, my aim in this post is to provide a simple reference for usage of class-based views for simple tasks without knowing the code base or glancing at the docs.
Instead I will write ...
I love to code. I love to cook (and eat).
Masterchef Australia is one of my favorite TV shows, because of my love for the latter. And because of my two loves, it was quite natural for me to draw comparisons between the two - Coding and Cooking, and more so between the format of Masterchef & how the technology team of at Glitterbug works.
In my opinion Masterchef has one of the most brilliant set-ups when it comes to reality shows. They don’t have a single dictator who fires the contestants at his whimsy, nor do they fire contestants based on votes (which are always decided by ‘beliebers’). They take their time to test each cook, give them ample time to learn & shine, before the panel makes a call. I really do believe, it’s a good model to have in a company. Not for firing people, no. We’re don’t believe in the policy of firing our people. But for testing any new technology or a new data storage or a programming language or even just a piece of code. For the sake of sanity, I’d be referring to these as STUFF.
Getting the Basics right...
Has this ever happened to you?
If you are reading this, I am guessing it has. Oh, the horror! Remember when your boss called you into his office and showed you this page? Remember the shame? So you turned autoindex off; and went back to your desk with a smug face. That was easy. But alas, your plans for world domination were still available to the world at http://yoursite.com/static/plans_for_world_domination.doc . You hung your head in shame, resigned to serve your static content from your wsgi server.
Look up my friend, this post is for you! You can keep your plans for world domination safe and still serve them at blazing fast speeds with a little Nginx trick called X-Accel-Redirect. What this does is allows Nginx to serve files when requested to do so by your application. All you application needs to is add an "X-Accel-Redirect" header to the response. I am assuming that you are using Nginx as a reverse proxy for your wsgi server. If you are not, then you should! Lets looks at the configuration.
Maybe I like things simple or maybe I’m just too naive to understand complex things.
As the most common breed of human beings now on the planet - A tech entrepreneur, I found myself not being able to come to terms with a few things. Always came across situations like these - Ohh.... why could not I think of that. It seems so simple. Or even worse- I thought of that, why did we not try it out, yet again.
What is it that I could not do? Make something users love. Make something which gets me like a gazzlion users in a few months. Where I’m the next big thing. Somewhere it’s a dream. Most of us might not admit it, but its there. The thought - Can we be the next Facebook or Quora or Pinterest or whatever there is now which allows you to share, connect, organize your life and see lots of photos.
So I decided to get into the root cause (àla Eric Ries & Toyota), trying to answer it with the 5 Whys
Why cant’ we make something that is cool?
At 25, I was having a Quarter-Life Crisis(I have no grave desires to live till I’m hundred, but for the lack of a better term, I’m sticking to ‘Quarter-Life Crisis’, so bear with me). I was two years in, on my first job that I’d gotten into during college-placements. The firm was a MNC that gave good competitive salary. I was lucky enough to get a Project Lead who was a great mentor, and worked under managers who believed in me. They even provided me with opportunities that not everyone in my peer group got (picking modules I liked to work on, and sending me for On-Site development while I was just a programmer trainee). But I always felt something was lacking.
I believe a little background is required to explain my POV:
I’m proud of my schooling from DPS Bhilai. They taught me programming on Quick Basic, GW Basic, Fortran, Pascal, Lotus, C, C++ starting from when I was 10 yrs old. I developed a natural affinity towards programming and spent my free time developing small games on C.
Now good as my job profile was at the MNC, there was little freedom, when ...
Keep in touch with what we do and how we roll, on twitter.