File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -103,10 +103,29 @@ would do this:
103
103
104
104
stream = self .scope[" url_route" ][" kwargs" ][" stream" ]
105
105
106
- Please note that ``URLRouter `` nesting will not work properly with
107
- ``path() `` routes if inner routers are wrapped by additional middleware.
108
- See `Issue #1428 <https://github.com/django/channels/issues/1428 >`__.
109
106
107
+ You can use [include](https://docs.djangoproject.com/en/5.1/ref/urls/#include)
108
+ function for nested routings. This is similar as Django's URL routing system.
109
+
110
+ Here's an example for nested routings. When you configure the routings in parent ``routings.py ``;
111
+
112
+ .. code-block :: python
113
+
114
+ urlpatterns = [
115
+ path(" app1/" , include(" src.app1.routings" ), name = " app1" ),
116
+ ]
117
+
118
+ and in child ``app1/routings.py ``;
119
+
120
+ .. code-block :: python
121
+
122
+ app_name = ' app1'
123
+
124
+ urlpatterns = [
125
+ re_path(r " chats/( \d + ) /$ " , test_app, name = " chats" ),
126
+ ]
127
+
128
+ you can establish the connection via the path such like ``/app1/chats/5/ ``.
110
129
111
130
ChannelNameRouter
112
131
-----------------
You can’t perform that action at this time.
0 commit comments