P
P
ProgramDevel2021-04-09 09:40:24
Django
ProgramDevel, 2021-04-09 09:40:24

Page not found?

I have urls.py

from django.urls import path
from . import views

urlpatterns = [
    path('', views.news, name='news'),
    path('gdz7', views.gdz7, name='gdz7'),
    path('chat', views.chat, name='chat') 
]


And views.py
from django.shortcuts import render
from .models import Post, Gdz7

def news(request):
    posts = Post.objects.order_by('-id')
    return render(request, 'news/index.html', {'title': 'Главная страница сайта', 'posts' : posts})

def gdz7(request):
    posts = Gdz7.objects.order_by('-id')
    return render(request, 'gdz7/index.html', {'title': 'Главная страница сайта', 'posts' : posts})

def chat(request):
    return render(request, 'chat/index.html')


Everything seems to be fine, but when you go to the "chat" page, the page gives an error
Using the URLconf defined in HelloDjango.urls, Django tried these URL patterns, in this order:

admin/
[name='news']
gdz7 [name='gdz7']
The current path, chat, didn't match any of these.


I uploaded all the files to the server, but it still does not work.
Please tell me what is wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question