Live data from Hacker News

Ask HN: Choosing a Python framework for web development?

news.ycombinator.com

11–20 of 41 posts

Re: Ask HN: Choosing a Python framework for web development?

#11
post #8

Start with Django unless you have a very good reason to use one of the other ones. Very good reasons include 1.) Previous skills with Mako, SQLAlchemy, Paste, or any of the other libraries that Pylons or Turbogears is based upon. 2.) Previous code in one of the above libraries 3.) Functionality needs that Django cannot satisfy in at least a couple of the following areas: authentication, user models, multiple database…

I've used Pylons, but not Django. Why is Django a better choice?

I was a big pylons fan until about a week ago. I had go take another look at Django this week for my job and for some reason it feels better. I recommend walking through the tutorial. You'll either like Django or reinforce your preference for Pylons.

Re: Ask HN: Choosing a Python framework for web development?

#12
post #10

Start with Django unless you have a very good reason to use one of the other ones. Very good reasons include 1.) Previous skills with Mako, SQLAlchemy, Paste, or any of the other libraries that Pylons or Turbogears is based upon. 2.) Previous code in one of the above libraries 3.) Functionality needs that Django cannot satisfy in at least a couple of the following areas: authentication, user models, multiple database…

Biggest annoyance for me so far with Django is it not following the MVC model I would have expected from it going in. We'll see how it works out for one of our newer/silly sites, though. I forgot to check out Pylons for the project one of our contractors is working on. Thanks for mentioning it, we might consider it if Django continues to be cumbersome.

It's an "MTV" framework: http://www.djangobook.com/en/1.0/chapter05/#cn16

Re: Ask HN: Choosing a Python framework for web development?

#13
post #8

Start with Django unless you have a very good reason to use one of the other ones. Very good reasons include 1.) Previous skills with Mako, SQLAlchemy, Paste, or any of the other libraries that Pylons or Turbogears is based upon. 2.) Previous code in one of the above libraries 3.) Functionality needs that Django cannot satisfy in at least a couple of the following areas: authentication, user models, multiple database…

I've used Pylons, but not Django. Why is Django a better choice?

I switched mostly because of the large collection of apps (= plugins, in other framework terminology) available for Django. The admin app gets most of the attention, but it's way more than that. For example, there's an app for built-in CSRF protecion. There's one for a comment system on any type of object, and another one for threaded comments. Generic tagging and voting apps. Instantly generated RSS (yeah, I know Pylons has this too, but it's built into the framework and not a 3rd-party add-on) or Sitemaps. There's an OpenID plugin. A way to automatically generate robots.txt files. A couple different forums, and a blog. (This is huge: in past projects, one of my biggest frustrations has been getting 3rd-party forums to interoperate with the site's custom authentication scheme. Django lets you use one user model for all components.)

http://code.djangoproject.com/wiki/DjangoResources#Djangoapp...

Some other things I liked about it: I thought that Django views were conceptually cleaner than Pylons controllers, with fewer global variables needed. I thought the templating language looked cleaner than Mako as well, though less powerful. The admin app saves me lots of time for mundane tasks that I'd probably just forgo otherwise. I could get used to the ORM - don't particularly like it, but as ORMs go, it's quite nice. I really like that it comes with authentication, sessions & user models built-in. I liked that it was well-documented.

Some things I thought Pylons did better: I think Pylons packaging & deployment is much more mature, built on setuptools, Paste, and eggs. I like that I don't have to use an ORM, and that it's loosely coupled in general. I like how Mako lets me define template functions directly in the template.

Also, Guido blessed Django as "the" Python web framework at SciPy 2006. So far, the rest of the world has basically ignored that pronouncement, and I haven't really heard anything further about it. But I thought that it was generally more prudent to be on the same wavelength as the BDFL.

Re: Ask HN: Choosing a Python framework for web development?

#14
post #3

Start with Django unless you have a very good reason to use one of the other ones. Very good reasons include 1.) Previous skills with Mako, SQLAlchemy, Paste, or any of the other libraries that Pylons or Turbogears is based upon. 2.) Previous code in one of the above libraries 3.) Functionality needs that Django cannot satisfy in at least a couple of the following areas: authentication, user models, multiple database…

Alright, thank you. I guess exactly what I was looking for. Couple of other questions that just popped up while reading your (thoughtful)reply a)- How much is the learning curve--considering my skill-set? From what I can tell from their website, I guess decent amount of documentation is available so I hope I won't get stuck. b)-My only fear is the lack of JavaScript(Ajax) skills. For that reason alone, I was interest…

Also note that nostrademons has written code in more frameworks than most of us web programmers have ever heard of. Just saying.

Re: Ask HN: Choosing a Python framework for web development?

#15
post #10

Start with Django unless you have a very good reason to use one of the other ones. Very good reasons include 1.) Previous skills with Mako, SQLAlchemy, Paste, or any of the other libraries that Pylons or Turbogears is based upon. 2.) Previous code in one of the above libraries 3.) Functionality needs that Django cannot satisfy in at least a couple of the following areas: authentication, user models, multiple database…

Biggest annoyance for me so far with Django is it not following the MVC model I would have expected from it going in. We'll see how it works out for one of our newer/silly sites, though. I forgot to check out Pylons for the project one of our contractors is working on. Thanks for mentioning it, we might consider it if Django continues to be cumbersome.

I'd be interested to hear how/why/where Django is cumbersome.

Re: Ask HN: Choosing a Python framework for web development?

#16

I prefer Pylons for many reasons. One of them is that SQLAlchemy is the single most powerful SQL library I've ever used, and Pylons makes it easy to use SQLAlchemy, while Django doesn't. This is just one example of Django's reluctance to use superior outside solutions.

Actually there has been a SQLAlchemy branch for over a year. Last I check it had stagnated - not enough interest.

Re: Ask HN: Choosing a Python framework for web development?

#17

I prefer Pylons for many reasons. One of them is that SQLAlchemy is the single most powerful SQL library I've ever used, and Pylons makes it easy to use SQLAlchemy, while Django doesn't. This is just one example of Django's reluctance to use superior outside solutions.

I'd have to second this. The Pylons project doesn't seem to suffer from the NIH syndrome that the django project does, and because of that, they're free to choose best-of-breed tools for every scenario. I think the fact that turbogears 2.0 is going to be based on pylons is a great win for both projects. It really gives you the feeling that if TheGreatestTemplateEngineEver or TheTransparentestORMEver gets invented tomorrow, these guys will be the first to support it. That kind of unashamed blatant code thievery deserves some respect. ;)

Re: Ask HN: Choosing a Python framework for web development?

#18
One thing you might try is to start by writing some small CGI webapps/scripts. Later on, it will give you an appreciation of what the frameworks are actually doing for you.

Also, if you're not married to Python, and are looking for something really simple and easy to learn, you might try Perl's CGI::Application (along with some plug-ins).

Re: Ask HN: Choosing a Python framework for web development?

#19
Study the source of existing sites you like. Then start writing your own Python framework upward to recreate (and fast transcend) them. Extensively study the existing frameworks, especially when you hit a conceptual or implementational roadblock. Understand everything you have to work with at each step. Keep building up.

Re: Ask HN: Choosing a Python framework for web development?

#20
If you're serious about learning web programming, here's a few thoughts before you pick up the Django book and start wading through it:

Take a look at the HTTP protocol, and learn what it does before you start diving in to web frameworks. You'll understand what's going on inside the framework before you get started.

After looking at HTTP, try some basic CGI programming. Just google: Python CGI Tutorial. CGI is a bit archaic, but it helps to understand why frameworks developed, and what they're making easier.

Pick up MySQL or PostGress and learn some SQL and databases first. Web frameworks are essentially an "easy" way to develop a GUI for a database. If you don't know what the database is, or what it's doing, you'll be chasing your tail learning a framework first.

It's worth mucking around with some *nix and apache. You don't really have to do this first, but you're not going to be able to do too much with your web app, because I don't know of too many companies that serve Django apps off of Windows. It's all Linux or BSD hosting for Django pretty much. That means knowing at least the basics of shell scripting and apache config files.

Post reply on HN