M
M
mim1mim2020-08-15 14:33:07
Django
mim1mim, 2020-08-15 14:33:07

What causes a 404 error in django?

Gives an error on startup5f37c7009c524163606428.jpeg

#mysite - urls

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

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

#train-urls

from django.urls import path
from . import views

urlpatterns = [
    path('train/', views.train),
]

#train-views

from django.shortcuts import render

# Create your views here.
def train(request):
  return render(request, 'train/train.html')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-08-15
@mim1mim

You have both urls.py written in such a way that the request must be to the address/train/train/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question