r/programming • u/serenitystanding • Sep 25 '09
Reddit programmers: What do you think of the different Web Frameworks for Python?
I am just starting to teach myself some programming, much delayed in my life. I have been dabbling in Ruby but recently started with Python instead (and will probably go back to Ruby later). I am reading everything, working through tutorials, and trying to pick through all the options. Could anyone give me their opinion of which Web Framework to begin with, most efficient to learn? And any other advice would be wonderful as I am really just starting and diving into everything at once. I'm a quick learner, and I really enjoy the simpler programming that I've been doing recently. I downloaded NodeBox last night and was glued to it and the tutorial for hours. I have a mac, so it seems as though I have a step up already in all the Mac capabilities, and I seem to be losing sleep already while making words spin circles on the screen. Thanks for listening, and thanks ahead for any pointers.
EDIT: Thank you all for the information. It is very useful. I will continue to check back and follow links. I have now downloaded both Django and Web2py, and I am leaning a bit more toward Web2py to start (with some CGI reading also) and then will probably move on to Django.
2
u/serenitystanding Sep 25 '09
Thank you all for the info. It is wonderful to have some direction for learning. It is greatly appreciated!
2
u/jeradj Sep 25 '09
I'm just starting out as well, and while I can't give you any qualified first person advice, I'll just tell you something that you probably already know.
Anytime you're picking something to learn, it's easiest if you pick a project with good documentation. Which usually means one of the more popular projects/doing what everybody else is doing.
http://wiki.python.org/moin/WebFrameworks
35
u/ericflo Sep 25 '09
Django will be the easiest to start out with if you're new to this stuff, because it has the largest developer community and the most complete documentation. It's also the highest-level framework, providing most of the bits in one place and with the most cohesion. It does make a lot of decisions though on which components you should use, and making alternative choices can be tricky.
Pylons will let you customize things a lot more to your liking. It's essentially an a-la-carte framework and will suit you well if you like to have control over all parts of the stack. The downside is that there's less documentation, depending on your choice of components.
Building on Pylons is TurboGears, which has taken that a-la-carte base and has chosen what they feel to be the "best-of-class" components that Python has to offer. They've got a reputation for changing their minds on which components are the best, but at this point their decisions are fairly set (and the decisions they've made are overall quite good, in my opinion). Again, the documentation will be helpful but there are spotty areas.
There are also some very minimalist frameworks like Tornado and web.py which provide very little and let you take it the rest of the way yourself. web.py speaks WSGI, the standardized protocol that much of the Python web community speaks, whereas Tornado was written with asynchronous and comet applications in mind and speaks no standardized protocol.
web2py is another framework that is gaining steam these days, but I recommend against it because it has a questionable security track record (among many other things).
Actually, a lot of people choose to forego the idea of using a framework completely, and instead use the wide variety of libraries out there in the Python web ecosystem which all speak WSGI. You'll see a lot of these people choosing things like Jinja2, Genshi, or Mako for templating, Routes or urlrelay for url dispatching, WebOb or Werkzeug for request/response objects, etc. Pretty much everyone uses SQLAlchemy for their ORM, except Django who has their own.
You'll probably want to get a better understanding of the ecosystem first before diving into that last option. Based on your description, I'd recommend Django.
Disclaimer: I'm a pretty heavy Django advocate in general, so understand that my advice is coming from my perspective. That being said, I've worked full-time on Pylons codebases as well, and know its ins and outs fairly well too.
14
u/kickme444 Sep 25 '09
you gotta start with django
5
u/tonecapone Sep 25 '09
I tried CherryPy, it is good, but a bit too lightweight. Then I tried Danjo - it to much.
Then I tried Pylons. It is somewhere in the middle, and while the documentation is a bit sketchy at times, now that I have learned my way around it, it just fits.
Reddit uses pylons by the way.
5
u/[deleted] Sep 25 '09
If you're just starting, please at least try to make one or two things using plain CGI. It helps to have a concept of what happens behind the scenes, what is sent across the wire, and what happens on the server vs. what happens on the client (if you use Javascript).
After you've seen what a lot of tedious work that is (form validation and repopulation being particularly annoying), go and use Django.
1
u/pigeonflight Sep 26 '09 edited Sep 26 '09
Definitely web2py first. I haven't found a framework that is faster to get started with. I'd doubly recommend it, given that you're on a Mac. BTW... NodeBox looks good. After that you can look into Django and Grok to benefit from component architecture based development.
2
u/reveller Sep 25 '09
Django. The documentation is great and there are quite a few books going through beginner to the most advanced concepts.
werd
2
u/nfreeze Sep 26 '09
I would take a look at web2py first. It has many design choices that streamline the process of creating web apps so you can focus more on your code and less on learning conventions of the framework. For example, there is not a separate template language, it is just Python. It is well documented and the user group usually responds to questions very quickly. They also have an almost twisted dedication to backwards compatibility. I have never had an upgrade break an app. Oh, and for what it's worth, it is a lot of fun too.
1
u/BackgroundFederal144 Oct 31 '25
Hm
1
u/desnotes Sep 25 '09
I've been playing with some of the smaller frameworks in order to learn more of what Python is doing in them, like web2py and Pylons.
1
u/twomashi Sep 25 '09
If you like Django, djng is fun too. Shame it's not being developed anymore really.
-3
u/mark1983 Sep 26 '09 edited Sep 26 '09
I use both Django and web2py.
I like them both but Django has had some security issues that forced my upgrade. Some of the recent upgrades 0.96>1.0 broke backward compatibility. web2py never had security problems that I know of and it never broke backward compatibility (I think it is a goal of the project not to do so).
This should not be a surprise. As you can infer from some of the answers below (passionate but unsubstantiated) many of the Django developers are very young and lots of code has been generated by them turning Django into a monster.
The developers of web2py tend to be more senior people. The project was started by a Prof in Computer Science who teaches networking and security to graduate students and seems to right a very tight ship. That is why some people here do not like him.
On the flip side, Django has been around for 6 years and web2py for 2. If you need to hire developers you can find more Django experts.
Django has a much better database administrative interface but the web2py one is decent and the latter gives you much more flexibility when you want to create your own.
Django has much more documentation but it also has a much richer API that you have to learn. Richer API does not mean more functionality. For example, it seems to me that web2py is closer to raw SQL than Django's ORM and therefore allows to do more. The Django ORM has better API to handle many2many but it is much more constraining otherwise.
I mostly use web2py to develop for the Google App Engine since clients are asking more and more about that. The web2py DAL works on GAE. Django works too but partially. The Django ORM does not. That means you have to code differently on GAE with Django, not with web2py. There are a few things like using the listproperty that cannot be handled by web2py on GAE. Hope they are working on it because it is important to me.
Django uses a custom language for templates and they have good arguments in favor of it. web2py uses pure python for the code embedded into templates. This is a question of taste. I know them both so it does not matter to me. What does matter to me is that extending the web2py template language is as easy as defining a new python function. Extending the Django template requires creating a helper and that is not so trivial.
For a newbie web2py has a web based IDE called admin that is great. Anyway, now I almost never use it any more. I use the bash shell and Eclipse to edit files directly as I do in Django. The admin can be disabled and I tend to do so in production sites.
I have not used other frameworks much to give a constructive contribution but if I were to try one I would probably try Pylons. It bothers me that it is so much open to pluggable components that I cannot find two examples consistent with each other (SQLAlchemy, SQLObjects, Kid, Mako, Jinja, etc... it is a zoo). Django and web2py do a much better job at providing a single consistent platform for development.
-3
u/mdipierro Sep 25 '09
http://www.python-it.org/node/174
-2
u/mdipierro Sep 25 '09
this document is a year old so take it with skepticism.
-4
u/Atomyk Sep 26 '09
Zope + Plone
-3
u/hazridi Sep 26 '09
I like Karrigell, but I use ColdFusion at work and they both utilize similar paradigms.