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
- [Answered ]-I want to display 'yyy' in the index.html, but when running the server, the page displays normally but without the 'yyy'
- [Answered ]-Django external app installation "Error: No module named nested-inlines"
- [Answered ]-How to add array of integer field in Django Rest Framework?
- [Answered ]-Why CSS works with "python manage.py runserver" but not with Gunicorn?
- [Answered ]-Django/Taggit Searching for posts when all tags and title are contained in the database
Source:stackexchange.com