python web programming for PHP programmers
Diez B. Roggisch
deets at nospam.web.de
Wed Dec 24 10:08:00 EST 2008
Nikola Skoric schrieb:
> I0m a python newbie with PHP background. I've tried to make a web app
> from one of my python scripts (which I haven't done before) and I
> ended up with:
>
> <?php
> echo shell_exec("python foobar.py");
> ?>
> which works really nice :-D
>
> For some reason I can't find no "quick and dirty python web
> programming tutorial for PHP programmers" on google. :-D I don't need
> a general python tutorial, I just need a tutorial on how to make a
> hello world server side script with python. Any suggestions?
Try googling mod_wsgi. While "real" python web-programming is usually
done a bit different (django, turbogears, pylons and lots of others I
forgot), I think it comes close to what a PHP-programmer would expect
how a webapp begins.
It boils down to a python-file saying
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
Well, I did the googling - here you have a starter:
http://code.google.com/p/modwsgi/
See the configuration-section.
HTH,
Diez
More information about the Python-list
mailing list