Repository: django/channels

Issue:
http request path attribute value init without FORCE_SCRIPT_NAME
- Detailed description of the overall behaviour

I am trying to deploy a channel application on a cloud PaaS platform.Howerver, when I use django function to get the absolute URI path, something go wrong.

In my case
Platform hostname: www.paas.com
My application root: www.paas.com/s/app/

```
def home(request):
      logger.info('root path: %s' % request.build_absolute_uri())
```

I found the logger get output 
```
root path: www.paas.com/
```

however, It is excepted to be 
```
root path: www.paas.com/s/app/`
```

- Reasoning why it should be in Channels rather than a third-party app

I check the django code about request path info. It has two attribute: `path` and `path_info`.`path` should be the full path of the URI.In the case , it should be `/s/app/`

- Examples of usage, if possible (it's easier to discuss concrete code examples)

Maybe scope['path'] should change a name?Something like scope['path_info']?



Discussion:
More Info for this issue.

In django/core/handlers/wsgi.py，line 81 .I found that request.path is combine by script_name and path_info.Maybe Channel should do the same thing?

Resolving patch:
diff --git a/channels/http.py b/channels/http.py
--- a/channels/http.py
+++ b/channels/http.py
@@ -35,14 +35,19 @@ def __init__(self, scope, body):
         self._post_parse_error = False
         self._read_started = False
         self.resolver_match = None
-        # Path info
-        self.path = self.scope["path"]
         self.script_name = self.scope.get("root_path", "")
-        if self.script_name and self.path.startswith(self.script_name):
+        if self.script_name and scope["path"].startswith(self.script_name):
             # TODO: Better is-prefix checking, slash handling?
-            self.path_info = self.path[len(self.script_name):]
+            self.path_info = scope["path"][len(self.script_name):]
         else:
-            self.path_info = self.path
+            self.path_info = scope["path"]
+
+        # django path is different from asgi scope path args, it should combine with script name
+        if self.script_name:
+            self.path = "%s/%s" % (self.script_name.rstrip("/"), self.path_info.replace("/", "", 1))
+        else:
+            self.path = scope["path"]
+
         # HTTP basics
         self.method = self.scope["method"].upper()
         # fix https://github.com/django/channels/issues/622


Test patch:
diff --git a/tests/test_http.py b/tests/test_http.py
--- a/tests/test_http.py
+++ b/tests/test_http.py
@@ -160,9 +160,23 @@ def test_stream(self):
         self.assertEqual(request.read(3), b"one")
         self.assertEqual(request.read(), b"twothree")
 
+    def test_script_name(self):
+
+        request = AsgiRequest(
+            {
+                "http_version": "1.1",
+                "method": "GET",
+                "path": "/test/",
+                "root_path": "/path/to/"
+            },
+            b"",
+        )
+
+        self.assertEqual(request.path, "/path/to/test/")
 
 ### Handler tests
 
+
 class MockHandler(AsgiHandler):
     """
     Testing subclass of AsgiHandler that has the actual Django response part