[Answered ]-Omiting path from url

1πŸ‘

βœ…

I have managed to fix this issue πŸ™‚

Step 1 :

In views.py :
We have to replace this code :


from django.shortcuts import render

# Create your views here.

def index(request):
    return render(request, 'chat/room.html', {
        'room_name': 'lobby_room'
    })

Step2:

In chat applications urls.py :
replace this code :


from django.urls import path

from . import views

urlpatterns = [
    path('', views.index, name='index'),
]

Step3:

Finally, replace this code in urls.py :

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('chat.urls')),
]

That’s it πŸ™‚

πŸ‘€Mahdi Ghofran

0πŸ‘

Url paths are defined in urls.py file in django. As you can see in your urls.py file you have added the chat app on chat/ path which means the app will be accessed at 192.168.43.175:8000/chat/.
So to serve the chat app to 192.168.43.175:8000/ url you simply need to replace chat/ with / in your urls.py like this

path('', include('chat.urls'))
πŸ‘€blaze2004

Leave a comment