Welcome Guest. Please Login or Register  


You are here: Index > AMPPS > General Support > Topic : Can't set up Python on AMPPS



Threaded Mode | Print  

 Can't set up Python on AMPPS (1 Replies, Read 8985 times)
snipergirl
Group: Member
Post Group: Newbie
Posts: 1
Status:
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.
IP: --   

Can't set up Python on AMPPS
tidus
Group: Member
Post Group: Super Member
Posts: 1121
Status:
Quote From : snipergirl April 2, 2013, 2:20 pm
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]


myapp.wsgi file is right.

Quote

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>


Change * to 127.0.0.1
Code
<VirtualHost 127.0.0.1:80>

Also append the following entry in C:\Windows\drivers\etc\hosts file
Code
127.0.0.1 example.com

Quote

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


You can skip this part as this is different method to run python script.
BTW giving path of python.exe instead of python folder in the first line of file should fix this issue. keep the file in cgi-bin folder.
Quote

Also nothing happens when I go to localhost/www/myapp - it says no such file or directory exists.


Access http://example.com/myapp instead.

Quote

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.

Sorry for the inconvenience. From next version we will try to give example of python script.

We don't include any module to run PERL at the moment you will have to use CGI. You can install perl script movable type from AMPPS scripts library to see how perl runs.


-----------------------
Follow AMPPS on,
Twitter : https://twitter.com/AMPPS_Stack
Facebook :  http://www.facebook.com/softaculousampps
Google+ : https://plus.google.com/+AmppsStack
IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is May 31, 2024, 1:22 am.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 10  |  Page Created In:0.023