views:

704

answers:

3

I've been looking really hard at all of the way**(s)** one can develop web applications using Python. For reference, we are using RHEL 64bit, apache, mod_wsgi.

History:

  1. PHP + MySQL years ago
  2. PHP + Python 2.x + MySQL recently and current
  3. Python + PostgreSQL working on it

We use a great library for communicating between PHP and Python (interface in PHP, backend in Python)... However, with a larger upcoming project starting, using 100% python may be very advantagous.

We typically prefer not to have a monolithic framework dictating how things are done. A collection of useful helpers and utilities are much preferred (be it PHP or Python).

Question 1:

In reading a number of answers from experienced Python users, I've seen Werkzeug recommended a number of times. I would love it if several people with direct experience using Werkzeug to develop professional web applications could comment (in as much detail as their fingers feel like) why they use it, why they like it, and anything to watch out for.

Question 2:

Is there a version of Werkzeug that supports Python 3.1.1. I've succefully installed mod_wsgi on Apache 2.2 with Python 3.1.1.

If there is not a version, what would it take to upgrade it to work on Python 3.1?

Note: I've run 2to3 on the Werkzeug source code, and it does python-compile without

Edit:

The project that we are starting is not slated to be finished until nearly a year from now. At which point, I'm guessing Python 3.X will be a lot more mainstream. Furthermore, considering that we are running the App (not distributing it), can anyone comment on the viability of bashing through some of the Python 3 issues now, so that when a year from now arrives, we are more-or-less already there?

Thoughts appreciated!

+1  A: 

I haven't used Werkzeug, so I can only answer question 2:

No, Werkzeug does not work on Python 3. In fact, very little works on Python 3 as of today. Porting is not difficult, but you can't port until all your third-party libraries have been ported, so progress is slow.

One big stopper has been setuptools, which is a very popular package to use. Setuptools is unmaintained, but there is a maintained fork called Distribute. Distribute was released with Python 3 support just a week or two ago. I hope package support for Python 3 will pick up now. But it will still be a long time, at least months probably a year or so, before any major project like Werkzeug will be ported to Python 3.

Lennart Regebro
+3  A: 

mod_wsgi for Python 3.x is also not ready. There is no satisfactory definition of WSGI for Python 3.x yet; the WEB-SIG are still bashing out the issues. mod_wsgi targets a guess at what might be in it, but there are very likely to be changes to both the spec and to standard libraries. Any web application you write today in Python 3.1 is likely to break in the future.

It's a bit of a shambles. Today, for webapps you can only realistically use Python 2.x.

bobince
The Python WEB-SIG may well keep arguing about this, but both mod_wsgi and CherryPy WSGI server are going to release for Python 3.X using what has become defacto standard for WSGI on Python 3.X. The wsgiref module in Python 3.X is also using the same thing and thus why in part is now defacto standard. See 'http://code.google.com/p/modwsgi/wiki/SupportForPython3X'.
Graham Dumpleton
Oh joy. What a total mess. Not that there's anything wrong with the proposed “de facto” standard(\*), but what Python-on-the-web really doesn't need is *more* fragmentation. \*: well, except for being able to return ISO-8859-1-encoded native strings which seems like an accident waiting to happen. And still no resolution on the PATH_INFO issue, but then I've given up on anyone ever fixing this...
bobince
Hi bobince. Just a heads up that we are now quite functional on Python 3 and mod_wsgi. We'll keep an eye on the standard as it solidifies, and adjust if needed. But there will be a lot of new application code written this next year that will not have to be re-done later.
gahooa
+1  A: 

I can only answer question one:

I started using it for some small webstuff but now moved on to rework larger apps with it. Why Werkzeug? The modular concept is really helpful. You can hook in modules as you like, make stuff easily context aware and you get good request file handling for free which is able to cope with 300mb+ files by not storing it in memory.

Disadvantages... Well sometimes modularity needs some upfront thought (django f.ex. gives you everything all at once, stripping stuff out is hard to do there though) but for me it works fine.

Jokey