I edited this question after I found a solution ... I need to understand why the solution works instead of my method?
This will probably be a stupid question. I tried to find other questions that are related ... but to no avail.
I am running Apache / 2.2.11 (Ubuntu) DAV / 2 SVN / 1.5.4 PHP / 5.2.6-3ubuntu4.5 with Suhosin-Patch mod_python / 3.3.1 Python / 2.6.2a>
I have a script called test.py
print "Content-Type: text/html"
print
print "hello world"
runs it as an executable ...
/var/www$ ./test.py
Content-Type: text/html
hello world
when I run http: //localhost/test.py , I get a 404 error.
What am I missing?
I used this resource to enable python parsing in apache. http://ubuntuforums.org/showthread.php?t=91101
... . ? #!/USR//
import sys
import time
def index(req):
sys.stderr = sys.stdout
blah1 = """<html>
<head><title>A page from Python</title></head>
<body>
<h4>This page is generated by a Python script!</h4>
The current date and time is """
now = time.gmtime()
displaytime = time.strftime("%A %d %B %Y, %X",now)
blah1 += displaytime
blah1 += """
<hr>
Well House Consultants demonstration
</body>
</html>
"""
return blah1