Saturday, October 1, 2011

Web Application on AWS using Python, Part One

Following an interview, I received an email:

Thanks for interviewing with us today. We all enjoyed meeting you and like your attitude a lot.

You mentioned you would be happy to do a coding challenge for us, and we would like to take you up on the offer. We want to get a better sense of your architecture elegance, attention to detail, and overall engineering ability with an open-ended challenge.

So here is our pretty big open-ended challenge for you: Write a clone of Hacker News (http://news.ycombinator.com) using Amazon Web Services and Python 3 on the back end.

Would you be willing to give it a shot?

Both Python and AWS were new to me. I started with installing Python 3 from python.org on my Windows laptop. Then I attempted to install Django, the leading web framework for python, from djangoproject.com. Unfortunately at the time of trying this, Django only worked with Python 2.4 to 2.7. So I went back and installed Python 2.7.

I started with the nice step by step tutorial available at the Django site to create my application. I soon realized I would need MySQLdb, a Python wrapper, to connect to my MySQL database (which was already installed). Now MySQLdb supported Python 2.3 to 2.6 at the time of trying this, so I had to uninstall Python 2.7.

MySQLdb source code is available at sourceforge.net, project mysql-python. However I didn't want to compile and try things out, as I needed to get this done fast. But installing binaries from sites where it was available complained other modules being missing and such. Finally I found that ActivePython from activatestate.com includeded mySQLdb, so I downloaded and installed the community edition version 2.6 from their site. Everything worked smooth from there. Thanks ActiveState! You will get my business someday.

I continued and created my application by following the tutorial at the Django site. It was a charm. It was just ActivePython 2.6, Django 1.3.1 and MySQL.

Coming in part two: deployment on the Amazon.com cloud.

No comments:

Post a Comment