I’m using mod_wsgi with a url prefix. my setup is:
Alias /prefix /path_to_wsgi_file/file.wsgi
<Directory /path_to_wsgi_file>
Options ExecCGI
SetHandler wsgi-script
...
</Directory>
I would like my django tests to simulate this situation so I could avoid differences between the testing and real env. That means I want request.get_full_path() to contain the /prefix
Any way to do that?
EDIT: after going through the source to understand what FORCE_SCRIPT_NAME does, looks like it’s used when wsgi.py calls set_script_prefix() of urlresolvers.
My problem is that this isn’t called when I run “manage.py test”.
I guess I could call this method myself in the test.
Any better suggestions?
Usually, you’ll have the
SCRIPT_NAMEproperly configured on the Web server and letreversehandle everything for you. If you want to configure a particular prefix to be applied, you can configureFORCE_SCRIPT_NAME, which will override any particularSCRIPT_NAMEthat may be configured or not.This will allow you to reverse and serve URLs on a given
/prefix.