Ticket #7930: dev_server__force_script_name.diff
File dev_server__force_script_name.diff, 1.2 KB (added by , 16 years ago) |
---|
-
django/core/servers/basehttp.py
557 557 BaseHTTPRequestHandler.__init__(self, *args, **kwargs) 558 558 559 559 def get_environ(self): 560 from django.conf import settings 560 561 env = self.server.base_environ.copy() 561 562 env['SERVER_PROTOCOL'] = self.request_version 562 563 env['REQUEST_METHOD'] = self.command … … 565 566 else: 566 567 path,query = self.path,'' 567 568 569 if settings.FORCE_SCRIPT_NAME: 570 prefix='%s/' % settings.FORCE_SCRIPT_NAME 571 if path.startswith(prefix): 572 # Remove FORCE_SCRIPT_NAME if path starts with this string. 573 # This makes it possible to server dynamic content and static 574 # (which would be outside of FORCE_SCRIPT_NAME). 575 # Drawback: URLs like /scriptname/scriptname/ are not accessible. 576 path=path[len(prefix)-1:] 577 568 578 env['PATH_INFO'] = urllib.unquote(path) 569 579 env['QUERY_STRING'] = query 570 580 env['REMOTE_ADDR'] = self.client_address[0]