Welcome Guest. Please Login or Register  


You are here: Index > AMPPS > General Support > Topic : Python and mod wsgi



Threaded Mode | Print  

 Python and mod wsgi (1 Replies, Read 9197 times)
muonshirata
Group: Member
Post Group: Newbie
Posts: 1
Status:
My Ampps Installation folder
D:\Program Files\Ampps

my httpd.conf
pastebin.com/T3uQfuT6

my python.conf
Code

LoadModule wsgi_module modules/mod_wsgi.so
DirectoryIndex  index.wsgi default.wsgi index.py default.py
WSGIPythonPath "D:/Program Files/Ampps/python/Lib;D:/Program Files/Ampps/python/Lib/site-packages;D:/Program Files/Ampps/python/DLLs"
WSGIPythonHome "D:/Program Files/Ampps/python"

<VirtualHost *:80>

    ServerName localhost
    ServerAlias 127.0.0.1
    ServerAdmin webmaster@example.com

    DocumentRoot "D:\Program Files\Ampps\www\wsgi-scripts"

    WSGIScriptAlias /myapp "D:\Program Files\Ampps\www\wsgi-scripts\myapp.wsgi"

</VirtualHost>


myapp.wsgi
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]


D:\Program Files\Ampps\www\wsgi-scripts\test.py
Code

print "Content-type: text/html"
print
print "<html>"
print "<head>"
print "<title>Test CGI</title>"
print "</head>"
print "<body>"
print "<h1>test!</h1>"
print "<p>By a Peaceful dark pond</p>"
print "<p>A frog plops</p>"
print "<p>Into the still water</p>"
print "</body>"
print "</html>"


output test.py
403 Forbidden

You don't have permission to access /wsgi-scripts/test.py on this server.

because i add handler .py to my http.conf

if i delete .py handler i get py code output.

i have read https://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide

i allready do that right click ampps tray icon ->configuration->ampps->python enviroment checked
but i'm still confuse. pleas help. thx.
IP: --   

Python and mod wsgi
tidus
Group: Member
Post Group: Super Member
Posts: 1121
Status:
Hi,

1. Revert all the changes you have made in the conf files python.conf, httpd.conf etc.

2. Create a folder in Ampps in my case "myapp"

3. Create a .py file in it, in my case "wsgi.py" with the following contents:
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]


4. Open Apache Configuration from AMPPS Application -> Apache Tab -> Configuration

5. Append the following lines in the end :
Code

WSGIScriptAlias /appname "D:\Program Files\Ampps\myapp\wsgi.py"
<Directory "D:\Program Files\Ampps\myapp">
    Order deny,allow
    Allow from all
</Directory>


6. Save the configuration file

7. Restart Apache

8. Access "http://localhost/appname" in my case, it should display "Hello World!".

Please open a ticket if you are facing any issues. We will look into it.


-----------------------
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 2, 2024, 1:33 pm.

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