from django.urls import path
from . import views
urlpatterns = [
path('index',views.index,name='index'),
]
#project urls.py
from django.contrib import admin
from django.urls import path,include
urlpatterns = [
path('admin/', admin.site.urls),
path('',include('chat.urls')),
]
views.py
from django.shortcuts import render
import random
def index(request):
# Generate a random number
random_number = random.random()
# Return the HTML template with the random number
return render(request, 'index.html', {'random_number': random_number})