I only know server side programming with PHP. To me, I write something into index.php
and call http://localhost/index.php
and see the results of the PHP script. I have been using CakePHP and understand that there is something you can do with URL rewriting, but in my mind, there is this one to one relation between URLs and PHP files on the server.
Now I do a lot with Python, but just command line utilites. I'd like to use Python instead of PHP for my next project. So far, I was told about mod_python
, that I have to use a framework like Pylons or Twisted or even Django to get any output at all. Others have said that I just have to print()
a HTTP header and then the script would output like I am used with PHP.
I would like to write something that basically only takes a directory listing and makes it pretty, so that I can access a bunch of PDF files from a mobile browser. I know how to do this with PHP, I know how to create a Python script that would generate the HTML. I just do not know how to execute that script when I open http://localhost/pdfcentral/
.
How would I have to configure my server? It runs on Ubuntu 10.04.
cgi-bin
directory so the server knows to execute it, and optionally make a PHP file redirect to it if you wish to use a different path. Regarding the Python script itself you can follow this procedure: forrestbao.blogspot.com/2009/08/…