path('chat/<str:room_name>/',views.room,name='room') replace this and try i just added "/"
On Sun, Jan 27, 2019 at 11:36 PM Vaibhav Kumar Chaudhary < vaibhavkumar...@gmail.com> wrote: > I am trying to create a chat app with Django Channels and facing a bit > problem here. > when I type chat room's name is the form it redirects with to that link > but my urls .py can not match that url and can not connect me to my views > > here is urls.py > from django.urls import path > from django.conf.urls import url > from . import views > urlpatterns=[ > path('chat',views.index,name='index'), > path('chat/<str:room_name>',views.room,name='room'), > > ] > > > for example, if I enter lobby it should redirect me to /chat/lobby/ > > this is my javascript code to redirecting > document.querySelector('#room-name-submit').onclick = function(e) { > var roomName = document.querySelector('#room-name-input').value > ; > window.location.pathname = '/chat/' + roomName + '/'; > }; > > Please help me where I am wrong > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/16083864-abac-47ae-b0ec-601d1912220b%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/16083864-abac-47ae-b0ec-601d1912220b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANR2Zjv-PUyNucJoWn9CySY8ZKx63YT94-QHQOXKuDxQK-RXfw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.