472,985 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,985 software developers and data experts.

Python web frameworks

There are a lot of web frameworks for python like django, mod_python,
spyce, turbo gears, Zope, Cherrypy etc. Which one is the best in terms
of performance and ease of study.
Nov 20 '07 #1
29 1519
The only one that I have used extensively is Django, which is very
easy to use and quite powerful in the arena for which it was created.
It has a powerful admin interface that automatically generates data
entry forms for content producers and a decent template system. It
has some definite drawbacks, though. The admin interface is difficult
to customize because it was not meant to be customized too much
(Django was written in a newspaper environment, where data needs to go
online quickly and be easily customizable for the next story or next
year's use). It also lacks ajax support.

I understand that Zope has a pretty high learning curve and is
currently in various stages of rewrite.

I don't know much about the others. Turbo gears uses Mochikit, which
hasn't had a new stable release in some time. I prefer jQuery myself.
Nov 20 '07 #2
On Nov 20, 2007 7:19 AM, joe jacob <jo********@gmail.comwrote:
There are a lot of web frameworks for python like django, mod_python,
spyce, turbo gears, Zope, Cherrypy etc. Which one is the best in terms
of performance and ease of study.
I wouldn't classify mod_python as a web framework: "Mod_python is an
Apache module that embeds the Python interpreter within the server.".

I haven't used all of the frameworks that you have mentioned, but I
really like what I have seen from Pylons so far.
Nov 20 '07 #3
On Nov 20, 2007 8:46 AM, BartlebyScrivener <bs**********@gmail.comwrote:
Django comes with its own little server so that you don't have
to set up Apache on your desktop to play with it.
Pylons too, it's good for development but using the bundled web server
is not recommended for production.
Nov 20 '07 #4
On 20 nov, 07:19, joe jacob <joejaco...@gmail.comwrote:
There are a lot of web frameworks for python like django, mod_python,
spyce, turbo gears, Zope, Cherrypy etc. Which one is the best in terms
of performance and ease of study.
I'm making web apps with CherryPy at work and it's quite good.
the official docs are a bit messy though but they left useful comments
in their code.
Nov 20 '07 #5
12/7. Django comes with its own little server so that you don't have
to set up Apache on your desktop to play with it.
I was rather shocked to learn that django only has this tiny server and does
not come with a stand-alone server and is supposed to run as
mod_python/cgi-driven app through apache.

Which reaps you of all the benefits of standalone servers like connection
pooling & caching data and so forth. Including sessions - I presume they
always go into the db/filesystem as PHP does.

Diez
Nov 20 '07 #6
Jeff:
I don't know much about the others. Turbo gears uses Mochikit, which
hasn't had a new stable release in some time. I prefer jQuery myself.
You can use jQuery with TurboGears if you develop custom widgets (I do so).
No problem here.

--
Thomas Wittek
Web: http://gedankenkonstrukt.de/
Jabber: st*********@jabber.i-pobox.net
GPG: 0xF534E231
Nov 20 '07 #7
On 20 Nov, 15:42, "Diez B. Roggisch" <de...@nospam.web.dewrote:
12/7. Django comes with its own little server so that you don't have
to set up Apache on your desktop to play with it.

I was rather shocked to learn that django only has this tiny server and does
not come with a stand-alone server and is supposed to run as
mod_python/cgi-driven app through apache.
The standalone server aspect of a large number of Python Web
frameworks typically involves BaseHTTPServer from the standard
library, as far as I've seen, excluding things like Twisted which
aspire to offer production quality server solutions themselves. This
was common back in the old days of Webware, in contrast to Zope which
used Medusa at the time, if I remember correctly.
Which reaps you of all the benefits of standalone servers like connection
pooling & caching data and so forth. Including sessions - I presume they
always go into the db/filesystem as PHP does.
I guess it's a compromise between deployment complexity and benefits
in the above areas, although mod_python should offer some relief in
some of the above areas. What people didn't like about Webware so much
was that run in the recommended way - with a standalone server which
communicated with Web server processes - people had to have separate
long-running processes, which various hosting providers didn't like.

What's most important is that you should be able to switch out one
server technology with another when you reach the limits of the
original, all without having to rewrite your application or do some
major re-plumbing. It does surprise me that mod_python is recommended
for use with Django in the various quick start guides I've read, but I
suppose that lets the developer avoid the issue of migrating up from a
simple server to something more scalable. Not that this should be a
problem, of course.

Paul
Nov 20 '07 #8
joe jacob a écrit :
There are a lot of web frameworks for python like django, mod_python,
spyce, turbo gears, Zope, Cherrypy etc. Which one is the best in terms
of performance and ease of study.
As far as I'm concerned, the winners are Django and Pylons (my own
preference going to Pylons).
Nov 20 '07 #9
On Nov 20, 9:42 am, "Diez B. Roggisch" <de...@nospam.web.dewrote:
12/7. Django comes with its own little server so that you don't have
to set up Apache on your desktop to play with it.

I was rather shocked to learn that django only has this tiny server and does
not come with a stand-alone server
Alas it is even worse than that, the development server is single
threaded and that can be a big problem when developing sites that make
multiple simultaneous requests at the same time (say if one of those
requests stalls for some reason). It is trivial to add multi threading
via a mixin (takes about two lines of code) but it does not seem to be
a priority to do so.

For large traffic though, Django is better than just about anything
other framework because it is built as multiprocess framework through
mod_python (rather than threaded). So there is no global interpreter
lock, thread switching etc. Django was built based in a real life
heavy duty use scenario, and over the years that really helped with
ironing out the problems.

i.


Nov 20 '07 #10
On Tue, 20 Nov 2007, joe jacob wrote:
There are a lot of web frameworks for python like django, mod_python,
spyce, turbo gears, Zope, Cherrypy etc. Which one is the best in terms
of performance and ease of study.
Personally I found zope/plone to be very much its own enormously complex world.
Performance was quite sluggish on a less-than-state-of-the-art computer. Part
of my problem was that my particular job didn't really fit with the particular
viewpoint (way of handling data) implicit in these programs. This might not
be the case for you - you'll have to evaluate that for yourself.

In the end I went with Django (hosted by mod_python/apache). Django thankfully
doesn't require that you use their "admin" as the access point for normal users,
though that means it will take more time and thought. It's still comparatively
flexible and straightforward in comparison to zope/plone. There are a few things
that I am not 100% satisifed with, but overall I have found django to be very
adaptible to my particular needs. All this despite the fact that this is a
pretty minor part of my work - I am pretty much a newby at developing for the web.

BTW the book - while still apparently not fully completed - is available for
free on the 'net.

-f
Nov 20 '07 #11
On Nov 20, 10:00 am, Thomas Wittek <m...@gedankenkonstrukt.dewrote:
Jeff:
I don't know much about the others. Turbo gears uses Mochikit, which
hasn't had a new stable release in some time. I prefer jQuery myself.

You can use jQuery with TurboGears if you develop custom widgets (I do so).
No problem here.
That's good to know, but I was intending to mean that TurboGears has
built-in support for Mochikit, while Django has no built-in Javascript
or Ajax support.
Nov 20 '07 #12
joe jacob a écrit :
(snip)
Thanks everyone for the response. From the posts I understand that
Django and pylons are the best. By searching the net earlier I got the
same information that Django is best among the frameworks so I
downloaded it and I found it very difficult to configure.
???

It's been a couple of years since I last used Django, but I don't
remember any specific complexity wrt/ configuration.
Nov 21 '07 #13
On Nov 21, 2007 5:42 AM, joe jacob <jo********@gmail.comwrote:
Thanks everyone for the response. From the posts I understand that
Django and pylons are the best. By searching the net earlier I got the
same information that Django is best among the frameworks so I
downloaded it and I found it very difficult to configure. I referred
the djangobook. Is pylons better in terms of performance and ease of
study compared to Django.
I have only used Pylons for the simplest of applications (Not because
I don't think it can handle complex applications, but because I am
trying to learn the framework) and find it very easy to configure.
That said, I think it's definitely worth your time to to either give
Pylons a try, or give Django more time.

This thread has been going for only a few days now, and I wouldn't
expect you'd have very intimate knowledge with any framework.
Nov 21 '07 #14
On Nov 21, 4:42 am, joe jacob <joejaco...@gmail.comwrote:
Django is best among the frameworks so I
downloaded it and I found it very difficult to configure. I referred
the djangobook.
It's not a turnkey type thing like WordPress or Joomla. It's a
webframework. Also watch versions. The book examples work only in .
96. It's easy in the tutorial to stray into docs for .95 or SVN. I
think that's part of the confusion.

rd
Nov 21 '07 #15
On Nov 21, 12:15 am, Graham Dumpleton <Graham.Dumple...@gmail.com>
wrote:
I would say that that is now debatable. Overall mod_wsgi is probably a
better package in terms of what it has to offer. Only thing against
mod_wsgi at this point is peoples willingness to accept something that
is new in conjunction with Linux distributions and web hosting
companies being slow to adopt new packages.
Yes that is to be expected, many people want someone else to pay the
early adopter's costs. Nonetheless mod_wsgi seems like the right
direction to move the python world.

One confounding factor that may slow its adoption could be the need of
running plain old CGI in an efficient way. I'm not sure how that fits
into the WSGI picture.

i.
Nov 22 '07 #16
On Nov 20, 7:55 am, "Joe Riopel" <goo...@gmail.comwrote:
On Nov 20, 2007 8:46 AM, BartlebyScrivener <bscrivene...@gmail.comwrote:
Django comes with its own little server so that you don't have
to set up Apache on your desktop to play with it.

Pylons too, it's good for development but using the bundled web server
is not recommended for production.
It's actually fine to use it for production. There's two servers that
are used commonly with Pylons, the one in Paste and the CherryPy
server (it's a one-line configuration change to switch). The
generally recommended production deployment is using one of these,
with another HTTP server in front proxying requests back. There's
lots of side-benefits to that particular setup, like hosting the
Pylons app alongside static files, PHP, etc. But there's quite a few
people who serve directly from Python (probably more often using the
CherryPy server, though I don't really know the differences in a
production situation).

Anyway, mostly an aside for choosing a framework.

Ian
Nov 22 '07 #17
"""Perhaps we need a pythonic FRONTEND. """

Should have happened years ago.
Nov 23 '07 #18
On Nov 22, 11:00 am, Istvan Albert <istvan.alb...@gmail.comwrote:
On Nov 21, 12:15 am, Graham Dumpleton <Graham.Dumple...@gmail.com>
wrote:
I would say that that is now debatable. Overall mod_wsgi is probably a
better package in terms of what it has to offer. Only thing against
mod_wsgi at this point is peoples willingness to accept something that
is new in conjunction with Linux distributions and web hosting
companies being slow to adopt new packages.

Yes that is to be expected, many people want someone else to pay the
early adopter's costs. Nonetheless mod_wsgi seems like the right
direction to move the python world.

One confounding factor that may slow its adoption could be the need of
running plain old CGI in an efficient way. I'm not sure how that fits
into the WSGI picture.
Practically running CGI quickly is hard. All of the modern batch of
frameworks contain too much code to do this; the startup cost of
loading all that code for each request is just too much.

For commodity servers that only support CGI scripts, and periodically
kill long-running requests, I had an idea for making WSGI applications
look like CGI scripts:
http://blog.ianbicking.org/2007/08/0...-isnt-fastcgi/ --
basically using the CGI script as a pipe to the application, with some
process management built in.

Of course, it still would need to be implemented. I suspect it would
be a fairly simple task for someone familiar with C.

This isn't really a big deal for most professional web developers, who
can control their server environment, but lack of this style of
deployment does make it a lot harder for web application users to use
Python applications.

Ian
Nov 23 '07 #19
TYR
On Nov 23, 4:22 am, SamFeltus <samfel...@gmail.comwrote:
"""Perhaps we need a pythonic FRONTEND. """

Should have happened years ago.
Python Internet Environment: PIE.
Nov 23 '07 #20
Graham Dumpleton wrote:
The other question is whether there is even a demand for this. Do
people want to be able to take unmodified Python CGI scripts and try
to run them persistently in this way, or would they be better off
converting them to proper WSGI applications.
I would personally be interested in such an adapter. While recently
considering whether to re-write a standalone mod_python application as CGI
or WSGI, I was scared off by this paragraph from PEP333:

-------------------------------------
Note: although we refer to it as an "application" object, this should not be
construed to mean that application developers will use WSGI as a web
programming API! It is assumed that application developers will continue to
use existing, high-level framework services to develop their applications.
WSGI is a tool for framework and server developers, and is not intended to
directly support application developers.
-------------------------------------

Do you have any thoughts about this warning? I'd much rather have the
performance of mod_wsgi for my application, so if you can provide any
mollifying views about WSGI's suitability for standalone applications my
first choice would be to use WSGI directly.

Regardless of its appropriateness for new applications, a CGI/WSGI adapter
would still be useful for third-party CGI scripts that I have no interest
in rewriting myself, as well as for the interim period during which my own
CGI applications are being rewritten. It would be advantageous for the
hosting company I work for, for example, to be able to boast that "your
python CGI scripts run faster on our mod_wsgi-enabled servers."
Thank you,
Jeffrey
Nov 26 '07 #21
On Nov 25, 1:55 am, Graham Dumpleton <Graham.Dumple...@gmail.com>
wrote:
The other question is whether there is even a demand for this. Do
people want to be able to take unmodified Python CGI scripts and try
to run them persistently in this way, or would they be better off
converting them to proper WSGI applications.
I think CGI will be with us for many decades.

It will be awesome if mod_wsgi can run CGI without invoking python on
each access.

i.

Nov 27 '07 #22
Istvan Albert schrieb:
It will be awesome if mod_wsgi can run CGI without invoking python on
each access.
For SCGI there is something like this: cgi2scgi: it is small executable written in C,
which connects to a running SCGI server.

Executing this small binary on every request is no big overhead.

Nevertheless I never used it.
Nov 28 '07 #23
On Nov 29, 2:36 am, Thomas Guettler <h...@tbz-pariv.dewrote:
Istvan Albert schrieb:
It will be awesome ifmod_wsgican run CGI without invoking python on
each access.

For SCGI there is something like this: cgi2scgi: it is small executable written in C,
which connects to a running SCGI server.

Executing this small binary on every request is no big overhead.

Nevertheless I never used it.
That isn't the same as what is being talked about here with unmodified
CGI scripts running under mod_wsgi. That program you are talking about
is more in line with what Ian was talking about, but would still
require the CGI script to be converted to work with SCGI directly or
WSGI and then use a SCGI/WSGI adapter.

Graham
Nov 28 '07 #24
On Nov 22, 11:22 pm, SamFeltus <samfel...@gmail.comwrote:
"""Perhaps we need a pythonic FRONTEND. """

Should have happened years ago.
It did. Mark Hammond embedded Python under MSIE about
the same time javascript and java applets came along (94, maybe?)
It didn't fly because of political and marketing problems,
I think. One technical killer was that C-Python can
be crashed relatively easily by malicious code, and
browser providers don't like that too much. Also, the
stuff you need to do to make it crash proof would make
the interpreter a lot slower (which may be why javascript
is pretty slow).

-- Aaron Watters

===
http://www.xfeedme.com/nucular/pydis...recognized+dim
Nov 29 '07 #25
TYR
On Nov 29, 3:15 pm, Aaron Watters <aaron.watt...@gmail.comwrote:
On Nov 22, 11:22 pm, SamFeltus <samfel...@gmail.comwrote:
"""Perhaps we need a pythonic FRONTEND. """
Should have happened years ago.

It did. Mark Hammond embedded Python under MSIE about
the same time javascript and java applets came along (94, maybe?)
It didn't fly because of political and marketing problems,
I think. One technical killer was that C-Python can
be crashed relatively easily by malicious code, and
browser providers don't like that too much. Also, the
stuff you need to do to make it crash proof would make
the interpreter a lot slower (which may be why javascript
is pretty slow).

-- Aaron Watters

===http://www.xfeedme.com/nucular/pydistro.py/go?FREETEXT=msie+de-facto+...
Time for another go, perhaps, seeing as the web has become the world's
default user interface?
Nov 29 '07 #26
Jeffrey Froman wrote:
While recently
considering whether to re-write a standalone mod_python application as CGI
or WSGI, I was scared off by this paragraph from PEP333:
<snip scary warning about using WSGI as an application API>

As a followup, I did go ahead and convert my CGI handler to WSGI, and doing
so was not difficult at all. The steps were basically:

1. accept environ and start_response parameters in the handler's __init__
2. return output from __iter__ instead of writing it to stdout.
3. pass environ and wsgi.input to the cgi.FieldStorage() parser.

I'd still be interested in a mod_wsgi wrapper for 3rd-party CGI scripts.
Thank you,
Jeffrey
Dec 7 '07 #27
Jeffrey Froman wrote:
>
I'd still be interested in a mod_wsgi wrapper for 3rd-party CGI scripts.
I doubt that this is possible, not because of the interface. But
conventional CGI scripts are implemented with the assumption of being
stateless. You would have to completely reinitialize them for each hit.
Without knowledge about the internal CGI script processing this would
mean reinitializing the whole Python run-time environment. So IMHO
there's no real gain. Just my 2 c.

Ciao, Michael.
Dec 8 '07 #28
On Dec 8, 8:26 am, Michael Ströder <mich...@stroeder.comwrote:
But conventional CGI scripts are implemented with the assumption of being
stateless.
while it might be that some CGI scripts must be executed in a new
python process on each request, common sense and good programming
practices would steer most people away from that sort of approach.

after all such CGI scripts would not execute properly under mod_python
either

i.

Dec 8 '07 #29
On Dec 9, 12:26 am, Michael Ströder <mich...@stroeder.comwrote:
Jeffrey Froman wrote:
I'd still be interested in a mod_wsgi wrapper for 3rd-party CGI scripts.

I doubt that this is possible, not because of the interface. But
conventional CGI scripts are implemented with the assumption of being
stateless. You would have to completely reinitialize them for each hit.
Without knowledge about the internal CGI script processing this would
mean reinitializing the whole Python run-time environment. So IMHO
there's no real gain. Just my 2 c.
One doesn't necessarily need to reinitialise the whole Python run time
environment. The hack that mod_python uses is to remember what Python
modules had been loaded before first request. At the end of the
request it will delete from sys.modules anything that was added since
the beginning of the request. It also replaces os.environ in its
entirety at the start of each request as well.

Yes, it may not still work for all CGI scripts, eg., C extension
modules may be a problem, but may be adequate for many. In fact, for
some class of CGI scripts, deleting all those modules from sys.modules
may not be necessary, provided you at least cause the main CGI script
file to at least be reinterpreted/reimported. What degree of cleaning
out the environment could be a configurable parameter of the WSGI/CGI
bridge.

So, although it can be done, it is the need to use strange hacks like
this that means it may just be better to convert CGI script to work as
WSGI, as more guarantee of success.

Graham

Dec 8 '07 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phillip J. Eby | last post by:
PEP: 333 Title: Python Web Server Gateway Interface v1.0 Version: $Revision: 1.1 $ Last-Modified: $Date: 2004/08/27 17:30:09 $ Author: Phillip J. Eby <pje at telecommunity.com> Discussions-To:...
4
by: John Benson | last post by:
Hi, I've been reading the above-titled book and it looks like some major Python and Zope features have been cherry-picked for pushing down into .NET, like application memory management (Python...
0
by: Neil Benn | last post by:
Hello, I'm attempting to determine what paths I would need on a win32, Linux, OSX box to run python. This should be a vanilla python with no extra packages (including tk). The paths I have...
18
by: Cameron Laird | last post by:
QOTW: "... So I started profiling the code and the slowdown was actually taking place at places where I didn't expect it." -- Guyon Mor?e (and about twenty-three thousand others) " suggestion...
1
by: John Chambers | last post by:
Sp my latest adventure is attempting to use python's Tkinter module on a few machines. On my PB (OSX 10.3.9), I got the following confusing results: /Users/jc: python Python 2.3 (#1, Sep 13...
4
by: Arnaud Delobelle | last post by:
Hi fellow python enthusiasts. Having recently acquired a MacBook Pro (Intel Core 2 Duo) which comes with python2.5, I have been installing some modules that I need (PIL, psycopg2, PyXML ...). ...
15
by: erik.oosterwaal | last post by:
Hi All, I have been developing websites in classic asp using VB script for a long while now. Due to the fact that I also took a detour to developing ColdFusion, and the fact the companies I...
1
by: Con | last post by:
Hi, I'm gettting a traceback when I attempt to read the MySQLdb docs after installation on Mac OS X 10.5.2: BEGIN TRACEBACK: Traceback (most recent call last): File "<stdin>", line 1, in...
8
by: Barry Warsaw | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the release of Python 2.6 final. This is the...
4
by: njwilson23 | last post by:
I'm having trouble with tkinter on a new installation of Python (2.6), built with the framework option from source that was downloaded from python.org. I'm running OS 10.4 on a PowerPC G4. The...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.