Python web development, really
paul at boddie.net
Tue Jan 21 12:34:28 CET 2003
Afanasiy <abelikov72 at hotmail.com> wrote in message news:<j9bo2v0lo0qfngcfpqc3ooj0bo881lhuuh at 4ax.com>...
> I would love to use Python instead of PHP for web development, but
> I have so far been confused by the options, or perhaps lack thereof,
> given my strict requirements. I would appreciate suggestions.
First of all, take a look at the PythonInfo Wiki:
This site is being updated and covers a lot more than the Web
Frameworks Overview. Certainly, the aim is to be able to help people
in situations like yours.
> Possible solutions should do 99% of the following :
> * Run on the same hardware I use currently
> * Be as fast or faster than Apache+PHP
> (I'm sorry to say Zope/Roxen are not)
> (This might mean it must use Apache)
Neither of these should be an issue.
> * Use a similar amount of memory
> (ie. not Java/.NET related)
Yes, we don't want the lights to dim when that application server
starts up. ;-)
> * Provide a fairly equivalent framework w/ sessions, cookies, get, post
> (Described in http://www.boddie.org.uk/python/web_frameworks.html)
> (eg. I should not have to write code to parse query strings, etc.)
> (PHP is somewhat unique in the ways it can bring in post variables)
I'm not familiar with PHP, but with most Python frameworks you don't
need to parse the raw HTTP inputs, and with many frameworks you have
convenient interfaces to those inputs. Webware provides a servlet-like
interface, although it's much more "sane" than the Java Servlet API
(in case you were wondering).
As for the "unique" aspects of PHP's variable handling, are you
referring to something like this...?
> * Allow all errors to be caught and handled so users never see them
> (I currently send them to an email address)
> (Users are notified an error occurred and a developer contacted)
I've been thinking rather seriously about better solutions than "we'll
just log the error and send an e-mail"; it seems to me that most
people don't have enough time to sift through lengthy log files, and
when e-mails arrive I'm sure most developers just want to delete them.
> * Allow sending of email
Python provides a number of ways of doing this, although an integrated
approach to application communications would be a lot more attractive
than firing up sendmail. I'm not sure of the state of Python
frameworks in this respect, although I suspect that Twisted integrates
the different communications "channels" better than most.
> * Allow sending of raw binary data, for restricted file downloading
> (eg. http://example.com/sendfile.php?id=A6DE12FAB3...etc)
> (This requires header manipulation, specifically the mime type)
> (That sort of thing should be part of the framework 3 bullets up)
You mean full control over headers and the ability to bypass the
> * Allow SSL secured authorize.net credit card processing
> (I currently use PHP's libcurl+ssl module)
This is presumably where your application connects out to another
application - some kind of back-end integration. This should be
possible, yes, but I'm not aware of any components for it that just
plug into a Python framework or application server, although there
could be a product available for Zope. Meanwhile, various Webware
people may have experience with this kind of thing even though the
Webware framework doesn't have a "checkbox feature" entitled "credit
> * Allow similarly powerful regex capabilities
> (I currently use PHP's pcre module)
Python's re module should suffice.
> * Big plus, but optional, auto prepend/append files
> (eg. Apache+PHP has .htaccess directives like this )
> ( php_value auto_prepend_file "_header.php" )
> ( php_value auto_append_file "_footer.php" )
> (granular down to the directory
That's an Apache thing, surely, so you might want to check to see
whether various frameworks and templating systems are open to such
external content manipulation - ie. that they generate page fragments
rather than full pages. I would guess that most systems are.
> * Finally, very optional plus, global application scoped variables
> (PHP does NOT allow this, but I know why)
> (I do not want to hear why you think this is bad)
> (I know why it is good, I know why it can be bad)
If you're not talking about the various exploitable PHP features, but
are actually referring to "shared data" or "singletons" which are
available to all requests running within a given application, there
are various means of achieving this in the different frameworks. It
would surprise me if the Webware Wiki didn't cover this topic, for
More information about the Python-list