为了账号安全,请及时绑定邮箱和手机立即绑定

在 Django 中找不到查看功能

在 Django 中找不到查看功能

不负相思意 2021-07-08 18:31:59
当尝试单击按钮重定向到 getonboard.html 时,出现以下错误:django.urls.exceptions.NoReverseMatch: Reverse for 'getonboard' not found. 'getonboard' is not a valid view function or pattern name.艺术数据库/urls.py:path('getonboard/',views.getonboard,name='getonboard'),模板/artdb/base.html:<p><a class="btn btn-primary btn-lg" href="{% url 'getonboard' %}" role="button">Get onboard &raquo;</a></p>艺术数据库/views.py:def getonboard(request):    return render(request,'artdb/getonboard.html')模板/artdb/getonboard.html:{% extends "artdb/base.html" %}{% block content %}<h2>getonboard template</h2>     <p>this is the getonboard text</p>{% endblock content %}完整的主 urls.py:"""winmalist URL ConfigurationThe `urlpatterns` list routes URLs to views. For more information please see:    https://docs.djangoproject.com/en/2.1/topics/http/urls/Examples:Function views    1. Add an import:  from my_app import views    2. Add a URL to urlpatterns:  path('', views.home, name='home')Class-based views    1. Add an import:  from other_app.views import Home    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')Including another URLconf    1. Import the include() function: from django.urls import include, path    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))"""from django.contrib import adminfrom django.urls import include, pathfrom django.conf import settingsfrom django.conf.urls.static import staticurlpatterns = [    path('artdb/', include('artdb.urls')),    path('admin/', admin.site.urls),]+static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 132 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信