I'm using mod_wsgi on apache2/Mac OS X by setting apache server as follows.
<Directory /Library/WebServer/Documents/wsgi/scripts>
Order allow,deny
Allow from all
</Directory>
<IfModule wsgi_module>
WSGIScriptAlias /test /Library/WebServer/Documents/wsgi/scripts/test.wsgi
</IfModule>
With this configuration, I could call test.wsgi with htt开发者_JS百科p://.../test
Now, I need to execute it by calling as follows.
http://.../wsgi/test.wsgi
I have the following code.
<Directory /Library/WebServer/Documents/wsgi/scripts>
Order allow,deny
Allow from all
AddHandler wsgi-script .wsgi
</Directory>
<IfModule wsgi_module>
WSGIScriptAlias /test /Library/WebServer/Documents/wsgi/scripts/test.wsgi
Alias /wsgi/ /Library/WebServer/Documents/wsgi/scripts/
</IfModule>
I thought about using Alias
so that I could link wsgi script directory to /wsgi/, and I expect Addhandler can handle the wsgi file, but it doesn't work.
What's wrong with my apache2 setup?
SOLVED
<Directory /Library/WebServer/Documents/wsgi/scripts>
Options ExecCGI Indexes
AddHandler cgi-script .cgi
AddHandler wsgi-script .wsgi
Order allow,deny
Allow from all
</Directory>
Alias /wsgi/ /Library/WebServer/Documents/wsgi/scripts/
Don't use AddHandler with WSGIScriptAlias, you need to use AddHandler with Alias directive. You will need to set ExecCGI option as well for directory. See:
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines
精彩评论