3👍
✅
Django only expects a SCRIPT_NAME
in the context of a web request. It is retrieved from the WSGI environment or the FORCE_SCRIPT_NAME
setting and set for the duration of the request.
To manually set a script name, use set_script_prefix()
:
from django.core.urlresolvers import set_script_prefix
set_script_prefix('/mysite')
Note that this is 1) a private, undocumented function, and 2) stored in a thread-local variable.
👤knbk
Source:stackexchange.com