Джанго: GET/HTTP/1.1" 404 2029 [дубликат]Python

Программы на Python
Anonymous
Джанго: GET/HTTP/1.1" 404 2029 [дубликат]

Сообщение Anonymous »

Я новичок в Джанго. Я получаю ошибку 404, не могу понять почему. Выполнял все инструкции шаг за шагом. Использование Django версии 3.1.1. Пытаюсь найти решение в Google, безрезультатно.
Когда я запускаю python Manage.py runserver , я получаю следующее сообщение

Код: Выделить всё

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
November 16, 2021 - 06:17:59
Django version 3.1.1, using settings 'lecture3.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Not Found: /
[16/Nov/2021 06:18:02] "GET / HTTP/1.1" 404 2029
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
November 16, 2021 - 06:25:43
Django version 3.1.1, using settings 'lecture3.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Not Found: /
[16/Nov/2021 06:25:46] "GET / HTTP/1.1" 404 2029
Ошибка на странице:

Код: Выделить всё

Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Using the URLconf defined in lecture3.urls, Django tried these URL patterns, in this order:

admin/
hello/
The empty path didn't match any of these.
Hello/urls.py

Код: Выделить всё

 from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name="index")
]
hello/views.py

Код: Выделить всё

   from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.
def index(request):
return HttpResponse("Hello, world!")
lection3/lecture3/urls.py

Код: Выделить всё

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

urlpatterns = [
path('admin/', admin.site.urls),
path('hello/', include("hello.urls"))
]
http://127.0.0.1:8000/ -> ошибка 404
но

Код: Выделить всё

http://127.0.0.1:8000/admin works fine
http://127.0.0.1:8000/hello works fine
Пожалуйста, помогите, нужна ваша помощь
Когда я удаляю последнюю строку path('hello/', include("hello.urls")) из лекции3/lecture3/urls.py http://127.0.0.1:8000/ работает нормально

Подробнее здесь: https://stackoverflow.com/questions/699 ... 1-404-2029

Вернуться в «Python»