> My friends over at reddit.com rewrote their site from Lisp to Python in the past week. It was pretty much done after one weekend.
It should probably be noted that this is from 2005.
> The Lisp newsgroup, comp.lang.lisp, was upset about the switch that they’re currently planning to write a competitor to reddit in Lisp, to show how right they are or something.
Wow, reading the newsgroup discussion was fascinating...and didn't reflect well at all on LIsp or its adherents, even though they were acting in the best spirit of hackers.
Oh, and isn’t reddit’s real problem that they’re busy changing implementation languages (!) while digg is sorta kicking their butts? I don’t know which site is doing better financially (does either one even have a biz model? What might it be, one wonders), but digg seems more polished, has a more pleasent UI, seems more featureful, and more popular.
Setting aside the Python v. Lisp debate (which is so boring and pointless), I’d hate to be in what seems to be reddit’s position: serious, robust competition and remaking fundamental tech decisions.
That was true back then. Nobody could foresee that Reddit would get acquired, and Digg would swing for the fences and fail.
Among other things Digg got overly ambitious, and took what turned out to be too much funding in the subsequent years. In the meantime, Reddit was growing organically under Conde Nast without the pressure of VCs looking for a return. Digg was forced to take big risks, and we know how it turned out.
Though the article is new to me I don't understand the context of this submission.
(Never using web.py and not being fully aware of Django's status in 2005) I see that overall they seem to have faired well. All you need is a settings.py file to run a Django app. The templating is slow performance-wise but pretty expressive.
I love that the Django community as a whole is pretty responsive to criticism. The 'Why Django Sucks' talk at DjangoCon is an example. My biggest complaint was the horrible User model (you cannot not have 'username' for a Django app using the User model). But they've fixed it now. The major complaint against Django is that it is monolithic, but the devs have worked hard to keep the system decoupled allowing one to replace most modules. But if you want something small Django is not the one for you I guess, and there is nothing wrong in it. One size fits all is never possible to achieve and not a good solution too.
I'd suggest Flask. Flask is a very lightweight microframework, yet it contains everything you need to write a web app in Python. If you want to write everything in one file with Flask, you can. If you need several files, you can do that. You can use proper views if you want. Or not.
Depending on the complexity of the project it might take you just as long to read how a monolithic framework decided to tie everything together (warts and all, because that will inevitably have historical cruft and technical debt).
The extensions were mentioned; User logins for example are just a "pip install Flask-Login" and "from flaskext.login import whatever" away. I had reason to roll my own, ~100 simple lines that were easily plugged.
There are pros and cons, neither is "better", the right tradeoff depends on what you're making.
Well, except that the login process for Django has a lot more people looking at it, and you know that the parts are going to work together pretty well.
For example, Flask-Login (https://github.com/maxcountryman/flask-login/blob/master/fla...) imports md5 and sha1 - not a very good sign. How do I make it use something sane? Well, there's Flask-Bcrypt, which provides bcrypt hashing... except that it makes no mention of Flask-Login or how to integrate it. Flask-Login also doesn't mention Flask-Bcrypt.
So... you're back to hacking on or digging into Flask-Login to figure out how it works and making it use Bcrypt or some other hashing algorithm.
Wait - I just realised that Flask-Login doesn't handle storing user data or models, or checking passwords, just logging them in. So what do I need for that? Is that Flask-Principal? And just WTH is an IdentityContext, anyway?
An IdentityContext is the context of a certain identity
against a certain Permission. It can be used as a
context manager, or a decorator.
You see why people use Django now? :) Sometimes you just want the standard user-logging-in-and-storing-in-the-database without having to write it yourself.
However, the Extensions library [-1] (which is not strictly speaking part of Flask) provides quite a lot of functionality - apart from your referred SQLAlchemy (which does the job well in our backend), there's a nice API generation factory [0] [1] and other neat stuff. For quite a lot of intents/purposes, flask extensions will do the job. But in the end of course it is a microframework. (From limited personal experience, a very neat general-purpose microframework nevertheless!)
[-1] http://flask.pocoo.org/extensions/
[0]
[1] A particularly sexy example that simply uses models from SQLAlchemy (from the quickstart in [0]):
manager.create_api(Person, methods=['GET', 'POST', 'DELETE'])
manager.create_api(Computer, methods=['GET'])
where Computer and Person are DB models easily defined with the help of SQLalch.
(This is not to counter (there isn't anything to be countered, just providing links / luring people..)
* Flask fan here.
Flask is not a "micro" microframework per se.
It provides a thin facade over werkzeug - which is anything but lightweight or micro.*
Another Flask fan here. If Armin says Flask is micro, and other frameworks which aren't considered micro are far larger than Flask, what makes Flask not a micro framework?
>It doesn't contain everything you need at all - that's why it's called a microframework.
I said everything you need to make web apps in Python, and I stand by that. Maybe it doesn't have an ORM or user account management, but for my purposes, it's great for small apps.
Having looked at both web.py nad Flask, web.py seems more elegant at first glance.
I like the mapping of a resource to class and method names to class method.s I am not sure I like Flask's method handling and having to do if ... elif .... else (maybe I just found some bad example, so please correct me).
Also url dispatching at the top makes it easier to understand what's going on rather than having it spread to each of the decorators somehow.
Flask and Sinatra are great. Easy to learn and easy to customize. They have stable APIs, unlike big frameworks like Rails and Django. This means you don't have to worry about what happens when you upgrade your application to the latest version.
Django isn't loosely coupled by default, but it can be used in a relatively loosely coupled way. E.g. you can easily use your own SQL and templating engine. Yes you can't just hot swap in a new web framework without rewriting the core app code, but that's the case with every framework.
Though this is 'old news' I was surprised by knowing who stands behind web.py.
Several years ago I was doing a little cozy web questionary tool and after trying Django, PHP, Perl, etc I've come to web.py framework. It was pleasure to work with databases, web templates, etc in web.py environment. I really enjoyed making the tool and the result code was tiny, clean and easy for understanding. Though it was a tiny tool I was very proud and next time I used web.py for a bigger project (proprietary for internal use only) and it was pleasure again.
Recently I've read three parts of "raw nerve" articles and found them interesting. But I didn't even pay attention on author's name. Now reading "Rewriting Reddit" all the pieces has been bringed together and I'm thankful to Aaron for his web.py and "raw nerve" articles.
I'd be very interested in hearing which of the criticisms against Django are still relevant, and which have been fixed. I've been using Django for a few years, and love it, but I don't really know what the state of Django was in 2005 and many of the things mentioned seemed, to me, to no longer be present. Then again, I haven't used web.py, so maybe there is a better way than Django in some areas I'm not aware of.
web.py was viewed as a big joke, because it was quite crude.
Django has merged the magic-removal branch a long time ago, pre 1.0 and since the newforms branch (also merged aeons ago) it can generate forms and validation. The template language is limited by choice which might or not be a good thing. Personally I think the idea is good, just the execution is inferior to Jinja2. If you don't like it, you can replace it, that's what loosely coupled means. aaronsw things loosely coupled means it is a library. It is not, it has stayed a framework and that hasn't changed since 2005.
when talking about the API he states ": I imagined how things should work and then I made that happen... So how should things work? The first principle is that code should be clear and simple. If you want to output some text, you call web.output. If you want to get form input, you call web.input."
This is beautiful and exactly what programmers need. I can't emphasize enough the importants of simple intuitive APIs. This, for example, is in my opinion the #1 reason why jQuery dominates web frontends.
Even as somewhat of a lisp weenie myself, I still think they made the right decision at the time. If this had taken place in 2012, it would be another story. Clojure is an awesome web language, and so is Ruby/JRuby. Hell, even Node.js would be a good fit for reddit.
It should probably be noted that this is from 2005.
> The Lisp newsgroup, comp.lang.lisp, was upset about the switch that they’re currently planning to write a competitor to reddit in Lisp, to show how right they are or something.
Here's what became of that: http://www.cl-user.net/asp/new