I have worked with Python for a while, but this is my first time that I have to install it and use it on a VPS server.
I have the following script hello.py
:
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
print '''
<!DOCTYPE html>
<html>
<head>
<title>Hello</title>
</head>'''
print "Hello World!"
I haven't been able to run the file on a browser. I don't know if it has something to do with the location of the script or with some other permissions I need to consider. I think there is nothing wrong with the code, because I copy exactly the same in another server (which I didn't configure) it works fine. Also, If I run the script from the console, it also works.
If I run the file on the location project/cgi-bin/hello.py
the browsers display "Internal Server Error". In console the error is: No such file or directory: exec of /project/cgi-bin/hello.py
.
If I run the file on the location project/hello.py
the browser displays plain text.
I've been reading a lot, and I think that maybe the problem has to do with some configuration on de HTTP, or Apache2 directory.
I would greatly appreciate your help.