Do I really need a web framework?
Roy Smith
roy at panix.com
Mon Sep 30 21:00:47 EDT 2013
In article <f4a6d31f-cffe-4c03-9586-4f00f9037516 at googlegroups.com>,
dufriz at gmail.com wrote:
> I want to set up a very simple website, and I need to know if it is necessary
> to use a web framework (e.g. Django) to do basic interactive operations such
> as receiving input from the user, looking up a database and returning some
> data to the user.
> I know that this is exactly the purpose of web frameworks, and that they work
> fine.
> However, I read somewhere that for small projects such operations can be
> managed without a web framework, just by using Python with mod_python or with
> the CGI module. Is this correct?
>
> What do you suggest, keeping in mind that I am a newbie and that my website
> project would be very simple and very small?
>
> Thanks
"Need" is a very difficult concept to pin down. At one level, no you
don't need a framework. There's nothing that a framework does that you
can't do yourself. On the other hand, there's a lot that frameworks do
for you that if you didn't get for free, you'd be forced to do yourself.
Something needs to accept connections on a socket, talk some HTTP to the
thing on the other end, parse the presented URL, talk to your database,
generate some HTML, etc. I'm sure you *can* do all that, but my guess
is most of it has little or nothing to do with your core application, so
it's just extra work you need to do to get where you want to be.
There's lots of different frameworks. Django is certainly one of the
major ones. It's very powerful, but it also has a bit of a steep
learning curve (despite its excellent tutorial). I've used Tornado as
well; it seemed quite a bit simpler and probably a better place to start
for a first project. I'm sure other people will suggest some others.
My recommendation is to read a bunch, pick one, and go with it. Don't
try to roll everything yourself.
There's a good (but, perhaps, outdated) list at
https://wiki.python.org/moin/WebFrameworks. Of the ones listed, the
only one I would really argue against is Zoap. As the wiki says, it is
the granddaddy of all python web frameworks, but the world has figured
out better ways to do things since then.
More information about the Python-list
mailing list