So I've followed all the directions on the Quick Configuration Guide for WSGI as well as the instructions suggested on one of the other python topics.
I have a subdirectory {path}/www/wsgi-scripts with myapp.wsgi in it:
Code 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]
I have put the following VirtualHost information in my apache\conf\httpd.conf:
Code <VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
ServerAdmin webmaster@example.com
DocumentRoot "C:/Users/The Oracle/Dropbox/Ampps/www/wsgi-scripts"
Alias /robots.txt "C:/Users/The Oracle/Dropbox/Ampps/www/robots.txt"
Alias /favicon.ico "C:/Users/The Oracle/Dropbox/Ampps/www/favicon.ico"
Alias /media/ "C:/Users/The Oracle/Dropbox/Ampps/www/media/"
<Directory /usr/local/www/documents>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias /myapp "C:/Users/The Oracle/Dropbox/Ampps/www/wsgi-scripts/myapp.wsgi"
</VirtualHost>
I've also added .py to the AddHandlers stuff.
My test application has one copy in {path}/www/test.py and one in {path}/www/cgi-bin/test.py with the following contents:
Code #!"C:/Users/The Oracle/Dropbox/Ampps/python"
print("Content-type: text/html")
print("")
print("<html><head>")
print("")
print("</head><body>")
print("Hello from Python.")
print("</body></html>")
When I try and load localhost/test.py I get
Code Forbidden
You don't have permission to access /test.py on this server.
in my browser and the following error in the apache error log:
Code Options ExecCGI is off in this directory: C:/Users/The Oracle/Dropbox/Ampps/www/test.py
When I try and load localhost/cgi-bin/test.py I get
Code Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at admin@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
in my browser and the following error in the Apache error log:
Code (OS 5)Access is denied. : [client 127.0.0.1:xxxx] couldn't create child process: 720005: test.py
(OS 5)Access is denied. : [client 127.0.0.1:xxxx] AH01223: couldn't spawn child process: C:/Users/The Oracle/Dropbox/Ampps/www/cgi-bin/test.py
Also nothing happens when I go to localhost/www/myapp - it says no such file or directory exists.
Not sure what's wrong with my configuration but I've followed the instructions as closely as possible.
This also seems very difficult to set up and I'm honestly not sure why this can't just work out of the box. There isn't even any information on the AMPPS website about how to set up Python. God knows how I'm going to go with setting up Perl.
|