Live data from Hacker News

Ask HN: Best Python web framework

news.ycombinator.com

101–110 of 110 posts

Re: Ask HN: Best Python web framework

#101
post #96
post #85

Earlier quoted context omitted.

I see. I will update. This test was also performed with Eventlet and I found Eventlet to occasionally fail requests. I have since switched over to Gevent and the performance is significantly better than Tornado now. I will update this test very soon to demonstrate.

Updated: https://gist.github.com/882555 - Same URL as on http://brubeck.io/readme.html , but with new data I just finished collecting.

Cool. Interesting discussion on the latest benchmark.

https://groups.google.com/forum/?fromgroups#!topic/brubeck-d...

Re: Ask HN: Best Python web framework

#102
post #90
post #19

(Full disclosure: I'm a member of Django's core team) There's no single "best" for every application. One-size-fits-none. One of Django's strengths is in the fact that parts of the framework come off easily when they no longer serve your needs. If the ORM is no longer working for you, you can use SQLAlchemy or write raw SQL. Authentication no longer working for you? Write your own or use a 3rd party one. Et cetera. T…

> I haven't had the "pleasure" of working with web2py, and I'm not knocking the effort which Massimo puts into it, but the choices made there often elicit a raised eyebrow. Ignoring my opinion for a moment, the smartest web hackers I know universally regard web2py as a fundamentally incorrect way to approach web development—but usually say so in far more colorful terms. I've just gone over the public discussions. The…

So web2py introduces new members to __builtins__? Coming from a general Python programmer with no "vested interest" I have to say that isn't the best of ideas. len/dict/list are builtins because they are part of the language. They can be assumed to be present in any Python program. Teaching people that these web2py objects are available globally w/o importing them is setting a false expectation. This is pretty much monkey patching even if you aren't overriding stuff. Generally a no-no in the Python community.

With great power comes great responsibility.

Re: Ask HN: Best Python web framework

#103
post #19

(Full disclosure: I'm a member of Django's core team) There's no single "best" for every application. One-size-fits-none. One of Django's strengths is in the fact that parts of the framework come off easily when they no longer serve your needs. If the ORM is no longer working for you, you can use SQLAlchemy or write raw SQL. Authentication no longer working for you? Write your own or use a 3rd party one. Et cetera. T…

> the smartest web hackers I know universally regard web2py as a fundamentally incorrect way to approach web development.

Are these the same web hackers that believe, say, using PHP is a fundamentally incorrect way to approach web development?

Re: Ask HN: Best Python web framework

#104
post #19

(Full disclosure: I'm a member of Django's core team) There's no single "best" for every application. One-size-fits-none. One of Django's strengths is in the fact that parts of the framework come off easily when they no longer serve your needs. If the ORM is no longer working for you, you can use SQLAlchemy or write raw SQL. Authentication no longer working for you? Write your own or use a 3rd party one. Et cetera. T…

And this is why I love the Python community. Almost every person in this thread is like "Django, but there are others".

I started on Pylons. I then used Django. So far I've been very happy with Django. I wish the ORM layer was more pluggable as well as the templating system. (I believe this is changing rapidly). But for the most part it works and it is great.

Re: Ask HN: Best Python web framework

#105
post #90

Earlier quoted context omitted.

> I haven't had the "pleasure" of working with web2py, and I'm not knocking the effort which Massimo puts into it, but the choices made there often elicit a raised eyebrow. Ignoring my opinion for a moment, the smartest web hackers I know universally regard web2py as a fundamentally incorrect way to approach web development—but usually say so in far more colorful terms. I've just gone over the public discussions. The…

So web2py introduces new members to __builtins__? Coming from a general Python programmer with no "vested interest" I have to say that isn't the best of ideas. len/dict/list are builtins because they are part of the language. They can be assumed to be present in any Python program. Teaching people that these web2py objects are available globally w/o importing them is setting a false expectation. This is pretty much m…

No, notice that "builtins" was in quotes. web2py does not actually add new members to __builtins__. Rather, web2py executes model files, controllers, and views in a pre-defined environment that includes a number of web2py API objects (though not the entire API). This includes about a dozen core objects, such as request, response, session, and cache, plus a set of HTML helpers (all derived from the same class and named after their HTML counterparts) and a set of form validators (all derived from the same class). This is all very well documented.

People like you who have never actually used web2py routinely express concern that this will somehow set up false expectations and confuse people about how Python modules and imports work, but in practice this is simply not the case. Note, web2py also includes a number of modules that require explicit importing, and applications can include their own modules as well as import standard library and third-party modules. As a result, web2py developers are perfectly comfortable with normal Python imports and do not have any false expectations.

Web2py is indeed using its "great power" responsibly.

Re: Ask HN: Best Python web framework

#106
post #90

Earlier quoted context omitted.

> I haven't had the "pleasure" of working with web2py, and I'm not knocking the effort which Massimo puts into it, but the choices made there often elicit a raised eyebrow. Ignoring my opinion for a moment, the smartest web hackers I know universally regard web2py as a fundamentally incorrect way to approach web development—but usually say so in far more colorful terms. I've just gone over the public discussions. The…

So web2py introduces new members to __builtins__? Coming from a general Python programmer with no "vested interest" I have to say that isn't the best of ideas. len/dict/list are builtins because they are part of the language. They can be assumed to be present in any Python program. Teaching people that these web2py objects are available globally w/o importing them is setting a false expectation. This is pretty much m…

Your reaction is very similar to the reaction people who have never used Python have when they discover Python has significant whitespace (with no vested interest against Python): "That's a horrible idea! It failed miserably for Fortran 40 years ago! That goes against everything I was taught!". Yes, it does not fit exactly with some mental model you already have. But no, it does not set up false expectations, much like Python does not set up false expectations of whitespace significance for C programmers who wrote a couple of Python programs.

Anthony already addressed the details in his reply below, but let me just add: IPython and sage essentially redo the python command line, and get nothing but praise. web2py, in some limited contexts (models and controllers) introduces a few useful names into the global namespace, and gets a ton of criticism.

Django (and just about every other framework) introduces a whole new language for templates, and no one squeaks, wheresa web2py uses plain Python as its template language with the smallest modification possible to provide that (you need to add "pass" at the end of a block, because you don't have indentation to guide you properly inside an html template; other template languages add an "endif" one way or another), and no one cares.

It is telling that all this criticism is coming from people who never use web2py, much like criticism of significant whitespace comes from people who do not use Python.

It is bigotry, disguised as a technical argument. In both cases.

Re: Ask HN: Best Python web framework

#107
post #96

Earlier quoted context omitted.

Updated: https://gist.github.com/882555 - Same URL as on http://brubeck.io/readme.html , but with new data I just finished collecting.

Cool. Interesting discussion on the latest benchmark. https://groups.google.com/forum/?fromgroups#!topic/brubeck-d...

Agreed! I am happy to have such smart people helping us develop the system

Re: Ask HN: Best Python web framework

#108

I really like bottle.py [1]. I've used it for a couple of different projects; although not fundamentally different from web.py or flask, it seems to just "make sense". [1] http://bottlepy.org/docs/stable/ An example from their website: from bottle import get, post, request @get('/login') # or @route('/login') def login_form(): return ''' ''' @post('/login') # or @route('/login', method='POST') def login_submit(): nam…

For comparison, here is the equivalent Flask code: from flask import Flask, request app = Flask(__name__) @app.route('/login') def login_form(): return ''' ''' @app.route('/login', methods=['POST']) def login_submit(): name = request.form.get('name') password = request.form.get('password') if check_login(name, password): return " Your login was correct " else: return " Login failed "

Thanks for that. I like both frameworks - in fact, I may use Flask for my next project.

Re: Ask HN: Best Python web framework

#110
post #48

Earlier quoted context omitted.

PHP guy here, don't know much about other languages, but seeing HTML mixed in with code is usually a bad code smell. Is this type of thing common in Python?

PHP is about mixing it with other stuff (hence the <?php tag). So PHP smells by definition :-)

JSP, ASP, CFM, Rails ERB, DJango ALL have the same exact thing. The only difference is PHP tutorials typically have a big block at the top of the "page" for business logic, and then intersperse logic throughout the view.

Most of these other frameworks/languages (barring CFM and old ASP) expect you to adhere to some sort of MVC.

Saying PHP smells by default is a little less than fair. :-)

Post reply on HN