From 5a38171fc7df38bcc8a2d2f061b8d2e0cc0c148f Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 10 Dec 2016 11:48:11 -0800 Subject: [PATCH] Fix #449: root_path was ending up as None --- channels/handler.py | 4 ++-- channels/management/commands/runserver.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/channels/handler.py b/channels/handler.py index f43da22..d247bc3 100644 --- a/channels/handler.py +++ b/channels/handler.py @@ -182,8 +182,8 @@ class AsgiHandler(base.BaseHandler): self.load_middleware() def __call__(self, message): - # Set script prefix from message root_path - set_script_prefix(message.get('root_path', '')) + # Set script prefix from message root_path, turning None into empty string + set_script_prefix(message.get('root_path', '') or '') signals.request_started.send(sender=self.__class__, message=message) # Run request through view system try: diff --git a/channels/management/commands/runserver.py b/channels/management/commands/runserver.py index 062ac46..8f0dda3 100644 --- a/channels/management/commands/runserver.py +++ b/channels/management/commands/runserver.py @@ -84,7 +84,7 @@ class Command(RunserverCommand): action_logger=self.log_action, http_timeout=self.http_timeout, ws_protocols=getattr(settings, 'CHANNELS_WS_PROTOCOLS', None), - root_path=getattr(settings, 'FORCE_SCRIPT_NAME', ''), + root_path=getattr(settings, 'FORCE_SCRIPT_NAME', '') or '', ).run() self.logger.debug("Daphne exited") except KeyboardInterrupt: