Hacker News new | ask | show | jobs
by ryanlm 3542 days ago
Can you set up Python to have the same pattern as PHP? I've always had to proxy the web server to the Python process running HTTP.
3 comments

Python via fastcgi, wscgi, etc, is the same pattern. Or mod_python inside Apache.

  import cgi
Also, the httpd communicates to the CGI program via environment variables so one can also write their program in assembly.
Yeah, I run new django apps right alongside my php5 code. It does definitely take a bit more "muss and fuss" than php5 to configure (mod_wsgi, etc) but is just as easy.

You also need to restart apache or change the wsgi loader file, (or set up explicit hoooks to do so) to get your new code to appear when debugging / after uploading changes. This is where I'd say php is superior (upload file, refresh browser).

Back in the day, mod_python also supported PSP (Python Server Pages), which was similar to PHP/ASP in that it allowed you to write a file as a mix of HTML and Python code inside delimiting tags.