Answer the question
In order to leave comments, you need to log in
Does not find the application and writes "page not found". What to do?
I write in advance that so far only a teapot and did everything according to the guide, but nothing happened.
Here's the problem.
INSTALLED_APPS = [
'webexample',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path(r'^admin/',admin.site.urls),
path(r'^webexample/', include('webexample.urls')),
]
Urls приложения:
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name ='index'),
]
Views приложения:
from django.shortcuts import render
from django.http import HttpResponce
def index(request):
return HttpResponce(" LLLLLLLLLLLLLL ")
Answer the question
In order to leave comments, you need to log in
if it's django >2, then you shouldn't use regular expressions in path(), that's what re_path is for.
try:
1. Replace regular expressions in project URLs with regular strings:
urlpatterns = [
path( 'admin/' ,admin.site.urls),
path( 'webexample/' , include('webexample.urls')),
]
2. Move your app to the end of INSTALLED_APPS
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question