我有一个问题,我的URL被视为无效的URL。 我的Django应用程序中没有一个URL起作用。 我犯了一个错误,即使用了我用于另一个应用程序的相同秘密密钥。 这是我的错误消息、URL页面和视图的图片。
from django.shortcuts import render
from home.models import Products
#This is the store view
def home(request):
return render(request,'home.html')
#This is the About Us page view
def AboutUs(request):
return render(request,'AboutUs.html')
#This is the Long Arm Services View
def LongArmServices(request):
return render(request,'LongArmServices.html')
#This is the product View
def product(request):
return render(request,'product.html')
urls.py:
from django.urls import path
from . import views
from django.http import HttpResponse
app_name='home'
urlpatterns = [
path('',views.home,name='home'),
path('about_us/',views.AboutUs,name='AboutUs'), path('long_arm_services/',views.LongArmServices,name='LongArmServices'),
path('product/',views.product,name='product'),
]
urls.py
的组合上。请参考答案。 - Willem Van Onsem