Le 20/08/2012 23:35, Dimitri Maziuk a écrit :
I ran the localhost version at /foo and so I had "/foo", "/foo/bar",
etc. in my Map. And then I set up mod_wsgi with "WSGIScriptAlias /foo
script" without realising mod_wsgi remaps "/foo" to "/" for the
script.
Let me reword this.
Let’s say that mod_wsgi is configured with:
WSGIScriptAlias /foo /var/www/myapp.wsgi
The app is not a the root of the domain. This can be useful if you have
multiple apps on the same domain.
Now an HTTP request for http://example.net/foo/bar arrives in Apache.
The path of this request is /foo/bar. It starts with /foo, so it is
dispatched to myapp.wsgi.
mod_wsgi will make a WSGI call with an `environ` dictionary. To prepare
this dict *it will split the path in two*. environ['SCRIPT_NAME'] is set
to '/foo', the part of the path needed to get to the app.
environ['PATH_INFO'] is '/bar', the part of the path "inside" the app.
Now the important part: *Werkzeug only uses PATH_INFO to match URL
rules*, so that you could move the app to a different prefix without
rewriting all the rules. In this case PATH_INFO is /bar; if all the URL
rules include the /foo prefix, none will match and Werkzeug will raise a
NotFound exception, which shows a 404 error.
The fix is either to remove the /foo prefix in the URL rules, or to
install the app at the root of the domain:
WSGIScriptAlias / /var/www/myapp.wsgi
In the latter case SCRIPT_NAME will be empty and PATH_INFO will get the
whole request path.
Cheers,
--
Simon Sapin
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en.