You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DirectoryIndex directive allows one to define a resource which is invoked
when accessing
against a directory. This resource cannot however accept any additional path
information.
The way around this is to use a rewrite rule such as:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /site.wsgi/$1 [QSA,PT,L]
Although this works, the resulting SCRIPT_NAME reflects the resource and not
the directory. To
get around that, one uses a fiddle such as:
def _application(environ, start_response):
# The original application.
...
import posixpath
def application(environ, start_response):
# Wrapper to set SCRIPT_NAME to actual mount point.
environ['SCRIPT_NAME'] = posixpath.dirname(environ['SCRIPT_NAME'])
if environ['SCRIPT_NAME'] == '/':
environ['SCRIPT_NAME'] = ''
return _application(environ, start_response)
In Apache 2.3 they have a FallbackResource which can be used in place of the
rewrite rule to do
same thing, but it still doesn't do the SCRIPT_NAME fixup. It may be desirable
to implement a
mod_wsgi specific mechanism the same as FallbackResource but which also does
the
SCRIPT_NAME fixup automatically.
Original issue reported on code.google.com by [email protected] on 4 Mar 2010 at 11:18
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 4 Mar 2010 at 11:18The text was updated successfully, but these errors were encountered: