I have started learning Python by writing a small application using Python 3.1 and py-PostgreSQL. Now I want to turn it into a web application.
But it seems that most frameworks such as web-py, Django, zope are still based on Python 2.x. Unfortunately, py-PostgreSQL is incompatible with Python 2.x.
Do I have to rewrite all my classes and replace py-PostgreSQL with something supported by web-py etc., or is there a framework compatible with Python 3.1?
Or maybe py-PostgreSQL is compatible with 2.x but I did not figure it out?
Update: this answer is out of date in 2011.
Unless you are interested in blazing a new trail while trying to learn Python at all, I'd recommend converting your project to Python 2.x. Hopefully your code doesn't use too many py-postgresql
features not found in the widely supported DB-API interface.
You should look at psycopg2
for a Python 2.x DB-API compatible interface or if you want to go higher-level SQLAlchemy
which in the svn release can use psycopg2
or py-postgresql
interchangeably.
You might also be interested in 3to2 which automatically converts Python 3.x code to Python 2.x code when possible.
Duplicate of #373945 What web development frameworks support Python 3?