def get_script_name(environ):
 if (settings.FORCE_SCRIPT_NAME is not None):
  return force_text(settings.FORCE_SCRIPT_NAME)
 script_url = get_bytes_from_wsgi(environ, 'SCRIPT_URL', '')
 if (not script_url):
  script_url = get_bytes_from_wsgi(environ, 'REDIRECT_URL', '')
 if script_url:
  if ('//' in script_url):
   script_url = _slashes_re.sub('/', script_url)
  path_info = get_bytes_from_wsgi(environ, 'PATH_INFO', '')
  script_name = (script_url[:(- len(path_info))] if path_info else script_url)
 else:
  script_name = get_bytes_from_wsgi(environ, 'SCRIPT_NAME', '')
 return script_name.decode(UTF_8)

def get_script_name ( environ ) : if ( settings . FORCE_SCRIPT_NAME is not None ) : return force_text ( settings . FORCE_SCRIPT_NAME ) script_url = get_bytes_from_wsgi ( environ , 'SCRIPT_URL' , '' ) if ( not script_url ) : script_url = get_bytes_from_wsgi ( environ , 'REDIRECT_URL' , '' ) if script_url : if ( '//' in script_url ) : script_url = _slashes_re . sub ( '/' , script_url ) path_info = get_bytes_from_wsgi ( environ , 'PATH_INFO' , '' ) script_name = ( script_url [ : ( - len ( path_info ) ) ] if path_info else script_url ) else : script_name = get_bytes_from_wsgi ( environ , 'SCRIPT_NAME' , '' ) return script_name . decode ( UTF_8 )
returns the equivalent of the http requests script_name environment variable .