Django路由-空路径与任何这些都不匹配

时间:2020-08-03 12:10:41

标签: python django

Django使用URLconf中定义的pccb_model.urls,Django按以下顺序尝试了这些URL模式:

predictive/
admin/

空路径与任何这些都不匹配。

img

1 个答案:

答案 0 :(得分:1)

是的,您需要在 pccb_model.urls 模块中为默认路径定义一个视图。确保 views.py 中有相应的方法。例如:

urls.py

path('', views.index)

views.py

def index(request):
    return HttpResponse('test', status=200)