ASK HN: Python framework for someone new to language

5 points by kingofspain ↗ HN
In a shocking turn of events, I decided to remove an old language from my brain (Pascal) and replace it with something a bit rad. I looked over Ruby (w/Rails specifically) for a bit and it didn't feel right to me but Python kind of clicked so I'm going with that.

I've read a lot here about Django and from the website the docs & guides seem pretty good and I think I'd be able to pick it up fairly sharpish. However, every time someone mentions Django there is a chorus of folks shouting "use X - it's better!" or "for eff's sake use Y! It has [unfamiliar-construct] which is essential!". Since I'm for all practical purposes on 'hello world' right now, I don't know how to evaluate these comments in the way I could with PHP frameworks for instance.

Now, I could just pick one up and go with it but I'm getting less & less free time these days and I'd like to waste as little as possible. Plus, I don't want to pick something that is perhaps for super-kings and will kill my enthusiasm.

TL;DR: If I go for Django, am I gonna be ok?

7 comments

[ 3.2 ms ] story [ 27.6 ms ] thread
http://www.web2py.com/book

A full stack web framework. Try it.

I'm invested in web2py and really like it but anyone considering using it should understand that the current python community does not think highly of it. It departs from some python conventions which irks many.

It's hard to go wrong with django but I found web2py much easier to use and more productive.

Yes, much much easier than Django. I don't know how teams cope with web2py but for a lone wolf, web2py beats everything out there. I don't know if its just me but Django makes me procrastinate whereas web2py helps me just start. db.define_table rocks.
You'll be fine with Django. Do the tutorial to get a feel, it should take one or two afternoons.
Django will be fine. It certainly has its annoyances but it has a nice ecosystem (= people to help you out, open source code to learn from and packages to do just about anything you need). It also has the best employment opportunities.

Once you're comfortable with Django have a look at some of the other frameworks such as Flask or Tornado - they may suit your way of thinking better and may be more suitable for certain projects (for example GAE stuff). There's no need to get pigeon-holed into one framework.

Whatever you do, however, avoid web2py - it messes with Python internals in nasty ways and will teach you bad habits:

http://www.reddit.com/r/Python/comments/ex54j/seeking_clarif...

Excellent. I think I'll go with the Django route. I guess if web2py looks tempting later (based off comment below), I can make an educated switch and know what's what. Thanks!
My advice is take 5 minutes with both (Django and web2py). Even if you choose Django, web2py has a web based IDE which will teach you the MVC design (which Django calls MTV).

web2y also takes much less time to get up and running therefore it is no really extra cost to try.

Most concepts translate line by line (Django admin ~ web2py appadmin, Django request.POST ~ web2py request.post_vars, Django request.GET ~ web2py request.get_vars).

The latest web2py also use a thread local object (a cool stolen from Flask). web2py has a pure Python template language, Django has a domain specific language for templates that is not Turing complete. In Django you have to explicit about everything (for example you have to list all mapping of URLs into function calls) while web2py has defaults and conventions (which can be overwritten) and it feels closer to ruby on rails.

Web2py comes with more stuff in the box (more supported databases, runs on Google App Engine including db queries, credit card payment api, multi-tenancy, multiple types of federated authentication, pdf generation, hooks for nginx/gunicorn/gevent, etc).

Web2py does not mess with python internals and has more readable code than Django, for example it does not uses complex meta-class programming for the ORM. What some do not like (but buys you a loot of goodies) is that web2py executes some of your code instead of importing it. This allows hot plug and play of applications (even in production) and allows to run multiple apps under one server without library conflicts.

web2py is very secure. For example it had cross-site-request-forgery prevention 2 years before Django did, despite being at least 4 years younger.

Both can be used exclusively from the shell. web2py can also be used from the web based ide but does not force it on you.