views:

173

answers:

4

Currently I do all of my web-based programming in PHP, and each day I get more and more anxious to try Python.

Not that I haven't played with it in an interpreter, but I mean really, write a web-based project in Python, and possibly move pretty much exclusively over to Python.

But, I know that Python isn't strictly a web-based programming language (which is awesome) which makes me wonder if there are any hoops to jump through to use it on the web.

A simple example would be, that I'm sure there's no $_POST like variables in Python by default. How does functionality like that find its way into Python?

How do I move from PHP to Python smoothly? How do I use Python on the web?

+2  A: 

Have a look at django web framework.

kgiannakakis
+3  A: 

Python is unlike PHP executed by a CGI like interface. This interface has an API to such variables.

Frameworks like Django incorporate that API. It's recommended to use such a framework which makes a lot of things easier.

Ikke
I'm looking into Django and other frameworks now, can you give an example of how the CGI interface can be used by Python minus a framework though?
Carson Myers
There are more then one interface. You have FastCGI and WSGI and even mod_python which is an apache module like php.
Ikke
I see, thank you
Carson Myers
Here is a tutorial: http://webpython.codepoint.net/mod_python_tutorial
Ikke
mod_python is *not* like mod_php, other than the fact that it embeds an interpreter into httpd. mod_python is not for running Python apps via httpd, but rather to extend httpd using Python code. The difference may seem trivial, but is *very* important.
Ignacio Vazquez-Abrams
+4  A: 

Here are some other web frameworks for your reference.

ghostdog74
+2  A: 

Many web frameworks exist for Python, such as Django, werkzeug, etc. If you want to get "closer to the metal" then look into WSGI.

Ignacio Vazquez-Abrams