If you really want to learn, don’t follow the book


I kept thinking about starting a web application on my own for a long time but it never materialized. Leave apart having a failed product, I did not create a product at all. I kept juggling ideas, sometimes relying on external developers and sometimes just hunting for one. The crux of this post is that for almost 2 years, I kept day dreaming of starting my app but it wasn’t until a month ago that I had something concrete and hopefully, promising. So, what did I do differently this time?

1. Stop looking for perfect partner – I know many people think they have a billion dollar idea and they can succeed if they could find the right tech co-founder. This problem has been written so often by people smarter than me that I shall not encumber you with further analysis.I spent nearly 8-10 months with few friends working on an idea (which was originated by me). I thought I did not have enough web development expertise and gave the technical development responsibility to another friend. Why didn’t it work? It’s hard for people to be motivated about someone else’s idea. No one can care about your idea as much as you can, so unless you have absolutely no background in programming (even that can be debated), there is no possible reason to think someone else can do justice to your idea. So, stop looking for a co-founder, learn how to code and start building. That’s what I did this time.

2. Stop reading inspirational posts and start building – I read a lot, sometimes I feel I read too much. It’s not bad but you should realize that reading will only get you fired up but that fire is useless if you don’t use it to actually build something. I love Swombat’s post on this topic.

3. Don’t follow the book – This was the most important part for me. You are fired up after reading those Hacker News posts and feel ready to conquer the world. You research and find there are two awesome web development frameworks out there and people say its damn easy to learn them – Ruby on Rails and Python/Django. You finally take a pick and start doing the awesome tutorials. You start off great and then the passion slowly dies away and you never actually finish that book. Worse still, you hardly remember what you did after few weeks. This is what happened when I started learning Rails in 2010. What I did differently in 2012 is: one, I zeroed in on an idea first (and picked Django but I don’t think that matters as much) and two, I gave myself a deadline. With this idea in my head, I started doing the tutorials and instead of following up the code and examples in the tutorial, I applied the concepts to my application and wrote code from scratch. The outcome was astonishing – I finished the basic chapters in a week and had a naïve application ready. Then, I quit on the book and started to further develop my app. Whatever I did not know, I searched on stackoverflow and django books on safari. If I found a book discussing an example that is very relevant for my idea, I would follow it else back to google. In this fashion, I learned concepts like basic CRUD, image handling, basic search, user account management, database migrations, integrating captcha etc. etc. as and when needed. No book will teach you all you need and following the examples blindly hampers your ability to think. This time, I learned the process so much better than the last time that I have created multiple simple apps, know the commands by heart and was able to create a decent app in our 24 hours Hackathon at Yipit. I consider it a decent accomplishment for someone who had never done web development before.


In these few months I created two products that are close to launch. First is Festsy, my attempt to make fashion more accessible in India – http://festsy.com Once I had coded the basic prototype, I decided to put out a sign-up page to validate that the demand exists for such a product. I sent out the sign-up page to friends and upon receiving good feedback, I started small adwords and analytics campaign. After seeing a conversion of 20%, I started taking the product seriously. Eventually, I resigned from Yipit a month ago and have decided to work fulltime on Festsy. The dream of working on my startup came true sooner than I expected but I realize there is a very long way to go to make it a success. If you want to know more, please check out the blog and jobs page – http://blog.festsy.com

Second product is LaunchValue which has a more interesting origin. When I was creating the sign-up page for Festsy, I felt that existing solutions like Launchrock and Unbounce were inadequate from design and price point of view. So, I created a simple django app to collect the sign-up emails myself. After getting some compliments on Festsy’s design page, I thought the app might have a demand for people like me. Again, to test out this assumption, I created launchvalue sign-up page – http://launchvalue.com and gathered interesting comments on HackerNews. When I saw few people signing up for paid services, I felt optimistic that I should launch this app and service. I am looking for CS engineers to join as partners or interns, so please ping me if you are interested or know anyone who might be. I would make it worthwhile your effort and time! If you are in India, please check out http://www.hellointern.com/viewprofile.php?sel=profile&id_vac=21550


I am no expert to give advice but what I have learned is that your success depends more on your resolution than on your talent. You can learn anything but you should not be learning everything. Be smart about setting a goal and then learn whatever is needed to realize it. That ways you are more likely to learn and remember what really matters. And I feel that is why Hackathons work so great because everyone is pushed to a deadline and a goal.

Launching toy prototype on Heroku!

I have been implementing few ideas in Django for past month or so but as exciting it might be to see your code working wonders on localhost, you really want to see it running live. Over last week, I explored various hosting options for Django and after reading a ton of posts and talking to few people, I picked Heroku. I also contemplated paying someone for it but I thought that investing a week in learning this is much more valuable and reusable than if I have to find and hire someone, explain my requirements (do it for every new project) and following up to make sure they are doing it right. Basically, it had come down to these 3 options-

  1. Webfaction – the de facto standard for a lot of python developers. It has good tutorials and seemed like the most straightforward guided hosting option.
  2. Linode – I talked to a friend who does professional django consulting and development and this is what he uses. But I figured that linode is more suited for professionals who know exactly how they want to setup their environment. Linode gives you most freedom if you know what you want but it can be overwhelming for novices. You are paying and you have to work.
  3. Heroku – the newcomer and the revered choice for rails application has finally embraced django. Heroku takes away all your hassles of configuring a prod environment and makes the deployment as easy as humanly possible. You are paying so that you work least. It does not mean it was all magical, you still need to understand what a good environment is and what are good prod practices. But I figured you need to learn those with any platform anyways, so why not invest some time in learning this growing service once and for all. It is probably very straightforward to people who have done it before (and I read a lot of pros switching to Heroku) but I spent 2 days figuring out minute details which even got frustrating at some points. But, in the end, I have a minimum working prototype up on web and I am loving it.

If I had to summarize past few weeks, it would be like this:

Get fairly comfortable with Django and already tried out few tutorials.
Learn the importance of good URLs.
How to start with minimal features and structure (urls) and fill out views later.
Always reuse opensource libraries – userena, imagekit etc.
Working with images can be a pain – getting PIL to work with jpeg was a nightmare but essential.
Understand the meaning and difference between static and media URLs (it took me unbelievably long time).
You are lucky to be developing in post twitter-bootstrap era. CSS will never have to be ugly now and anyone can design a professional looking web app.
Beauty of django ORM is that I can use mysql in dev and postgresql freely supported on heroku (use south for migrations).
Git is godsend, learn it asap.
Heroku needs virtualenv, so learn it.
Deploying my toy app on heroku cost me $0 so far (its non-persistent and slow but I don’t care right now). I can keep iterating and getting feedback from friends while adding those few missing components needed to launch the project live.
Internet has all the answers, just be persistent and think what is the right question.

The bottom line is learn whatever it takes to go live!

Anyways, here is my toy prototype live – http://smartbride.herokuapp.com/ (the picture links get broken in sometime due to non-persistence)
The fun has just begun, more updates soon.

Setting up Django with MySql – with and without MAMP

In this post, we will discuss the steps needed to get your django work with mysql database  on Mac OS Lion – there are 2 ways you can use mysql. It comes packaged with MAMP and if you are already using it, you can configure mysql within MAMP to get running with django. The advantage is MAMP’s front end controls and built in phpmyadmin. Otherwise, you can install both mysql and phpmyadmin fresh.

But before that, you should install python and django as covered nicely in Django Book. What it doesn’t cover in detail is getting the database setup, so refer to the following once you reach ‘Setting up the database’ section.

  1. First, we need MySQL server. If you already have MAMP installed, you dont need this step, skip over to next. If you dont, lets install MySQL community server from http://dev.mysql.com/downloads/mysql/ I downloaded the then latest mysql-5.5.20-osx10.6-x86_64.dmg and followed the instructions. If you set the preferences correctly in Startup Package and Preferences Pane (double click MySQLStartupItem.pkg and then MySQL.prefPane), you can configure mysql to be started/stopped from System Preferences. We did this to have easy controls to start and stop mysql.
  2. Setup mysql-python package– Although you have installed mysql, we need MySQLdb package to allow it to work with python. I have heard you can use pip or easy_install to install this package easilybut it can start giving errors sometime. So, here is the longer route but one which I have successfully tried and hopefully you can too. First, get mysql developer package to have all the files-
    • From the same mysql download url, download the latest tar.gz package (version should be same as the dmg file you downloaded in step 1). Put it in your home dir and execute following command-cd ~; tar -xvzf mysql-5.5.20-osx10.6-x86_64.tar.gz
    • This will create a dir called mysql-5.5.20-osx10.6-x86_64. Copy this dir over to /usr/local using the command sudo cp -r mysql-5.5.20-osx10.6-x86_64 /usr/local/
    • Now, rename this dir in /usr/local to mysql using
      sudo mv -r /usr/local/mysql-5.5.20-osx10.6-x86_64 /usr/local/mysql
      With this, we have created a hard copy of our latest mysql. If you upgrade your mysql in future, follow the same steps. Alternatively, you can create a symlink too.
    • Add this to your .bash_profile (created in previous post in your home dir) so that your system will know where to find mysql related files –
      export PATH=$PATH:/usr/local/mysql/bin

    Next, install mysql-python package-

    • Download the latest MySQL-python package from http://sourceforge.net/projects/mysql-python/files/mysql-python/ to your home dir
      Execute following commands-
      cd ~; tar -xvzf MySQL-python-1.2.3.tar.gz
      cd MySQL-python-1.2.3
    • Edit site.cfg on vi and change the mysql path as follows
      mysql_config = /usr/local/mysql/bin/mysql_config
    • Lets build and install MySQL-python package now:
      sudo python setup.py build
      sudo python setup.py install
    • IMPORTANT: Edit your ~/.bash_profile, add the following line:
      export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
  3. Lets test our setup to make sure everything is working as expected-
    On terminal, type python to start python shell. On python shell, type ‘import MySQLdb’. If you see no errors, you are good to go!

The steps 2-3 are required both with and without MAMP. Next, few helpful things-

  1. with MAMP – if you have MAMP, you already have phpMyAdmin installed and instead of starting MySql through system preferences, you can control it from MAMP interface. Further, I have these in my .bash_profile to use mysql from MAMP-
    alias mysql=/Applications/MAMP/Library/bin/mysql
    alias mysql_config=/Applications/MAMP/Library/bin/mysql_config
    Other thing to note, when you will setup your own django project, use this in settings.py -‘HOST’: ‘/Applications/MAMP/tmp/mysql/mysql.sock’
  2. without MAMP – lets install phpMyAdmin to manage our mysql server using instructions given here. I tried and it worked great, so I dont want to duplicate the efforts. Lastly, in your settings.py, you will leave ‘HOST’ empty when you setup your own django project.

So, are there any particular advantage of using mysql with or without MAMP? – I dont think so. I used both of them and did not feel any difference worth worrying over. So, take your pick – if you have MAMP, use it. If you dont, you definitely dont need it for django.

See previous article on Getting started to code with Python/Django – Learn Python/Django and get ready to launch your own idea on Internet

In next and last article, I will post how I learned the rest and got to build my own django app.

Learn Python/Django and get ready to launch your own idea on Internet

You have ideas but you never got to create something because you are not a developer or specifically a web developer. That has become such an ubiquitous problem that its not an acceptable excuse anymore. Thankfully to the rapidly evolving web frameworks, you dont need to know a ton lot to create your own application prototypes. I have programming background but never did web development before until 12 days ago. Since it was really not as difficult as one expects, I thought I’ll share the experience and encourage aspiring entrepreneurs, web developers to try it for themselves.

Django or Rails – If you have never heard the word Django before, don’t fret – its a web framework for Python which is incidentally evolving very fast and possibly stealing people away from Ruby on Rails. You can read this discussion on Django vs Rails on Quora if you are undecided between the two. I had tried Rails before (following the excellent tutorial from Michael Hartl) just to get a feel of all the hype surround RoR and found it great at that time. I never delved deeper as I was not trying to actively build something but when I tried Django over past few days, I can definitely say that Python is easier to learn than Ruby and Django offers several advantages over Rails – biggest for me is the ready-made admin interface. More and more companies are leaning towards Python/Django now and if you have to take a pick, I bet Django is the way to go.

I’ll document how I learned Django to create a standalone application over a series of posts. Since I am familiar with object oriented programming, linux command line and mysql before, I did it at faster speed but even if you dont, you can do this in few weeks.

Overall, this was my learning path:

  • Day 1 – Setting up Django on your laptop
  • Day 2-5 – Reading and working the examples given in Django book
  • Day 6-10 – Start following Django 1.0 Website Development by Ayman Hourieh and apply the steps in building prototype of your own idea (if you do not have an idea yet, simply follow his examples)
  • Next – Add other functionality to your idea as needed (google for solutions when you are stuck) + work on design (which is a whole new beast)

This first post is going to cover ‘getting started on Mac’ (isn’t that what everyone who is interested in this post using now anyways?)-

Setup Terminal – I recommend that you setup a happy coding environment (terminal) before you begin – this can make a lot of difference in your motivation and desire to proceed especially when you are frustrated on being stuck somewhere. If you have never used Terminal before, you can read a crash course. Terminal offers various theme settings, I recommend using one with dark background – I personally use Pro (semi transparent black background and white text).

Just learn the basic cd, ls, mkdir, ln, chmod, sudo commands and try to be comfortable with some text editor – I recommend vi (if you have never ever done this, spend 2-4 days learning to enjoy this). Now, the happy part, add this to your .bash_profile (if it doesn’t exist, create one using sudo vi ~/.bash_profile)

# configure my multi-line prompt
==> \e[m’

It should make your prompts colorful, mine looks like this-

Next, I wanted a good coloring scheme for vi because you will be spending a lot of time writing and editing code inside vi editor (if you choose to go along with it). So, I added this to my .vimrc (create one if needed – vi ~/.vimrc)-

colo desert
syntax on
set number
set expandtab tabstop=2 shiftwidth=2

And now, my vi editor is colorful, highlights the syntax, shows line numbers (helpful in debugging when you get an error), sets tab at 2 spaces as used in many coding examples online –

And that can make a lot of difference when you are spending hours on command line following the examples from django books. I have barely touched anything in depth but with these minimal efforts, you can get going. If you have any questions, leave a comment and I’ll try to help.

Next post will cover setting up Django and mysql on Mac. If you want to read some other helpful posts meanwhile, try Eddy Chan’s How I learnt Python Django.

Update: Read next post – Setting up Django and MySql with and without MAMP here.