django / channels

Developer-friendly asynchrony for Django
https://channels.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.02k stars 793 forks source link

support URLRouter with include #2037

Closed jjjkkkjjj closed 4 weeks ago

jjjkkkjjj commented 11 months ago

I tried to implement to support URLRouter with include Usage:

In parent's routings.py;

urlpatterns = [
    path('chats/', include('pj.chats.routings'), name='chats'),
]

In child's routings.py;

app_name = 'chats'

urlpatterns = [
    re_path(r"/(?P<room_name>\w+)/chat/$", ChatConsumer.as_asgi()),
]
carltongibson commented 11 months ago

Hi. Can you add some unit tests exercising the feature please?

jjjkkkjjj commented 1 month ago

@carltongibson I'm very sorry for late response... (I forgot it...) OK, I'll try to implement unittest!

jjjkkkjjj commented 1 month ago

@carltongibson I've just fixed indentation error and implemented the unittest (test_url_router_nesting_by_include in tests/test_routing.py)! Please check it again.