Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 诺维森匹配'的正/反转;仪表板';没有找到';仪表板';不是有效的视图函数或模式名称_Python_Django - Fatal编程技术网

Python 诺维森匹配'的正/反转;仪表板';没有找到';仪表板';不是有效的视图函数或模式名称

Python 诺维森匹配'的正/反转;仪表板';没有找到';仪表板';不是有效的视图函数或模式名称,python,django,Python,Django,我是django的初学者,我已经在上周开始了这门课程,并且在过去的两天中陷入了这个错误。寻求帮助摆脱我造成的混乱 我无法打开我的网站的仪表板,我不知道发生了什么。 我从过去两天一直在寻找这个。还是什么都没有 环境: Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 2.2.3 Python Version: 3.7.3 Installed Application

我是django的初学者,我已经在上周开始了这门课程,并且在过去的两天中陷入了这个错误。寻求帮助摆脱我造成的混乱

我无法打开我的网站的仪表板,我不知道发生了什么。 我从过去两天一直在寻找这个。还是什么都没有

环境:

    Request Method: GET
    Request URL: http://127.0.0.1:8000/

    Django Version: 2.2.3
    Python Version: 3.7.3
    Installed Applications:
    ['pages.apps.PagesConfig',
     'listings.apps.ListingsConfig',
     'realtors.apps.RealtorsConfig',
     'accounts.apps.AccountsConfig',
     'django.contrib.admin',
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'django.contrib.humanize']
    Installed Middleware:
    ['django.middleware.security.SecurityMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware']
模板错误:

    In template C:\Users\kamal jeet singh\wproject\kt\webproject\Template\partials\_nav.html, error at line 50
       Reverse for 'dashboard' not found. 'dashboard' is not a valid view function or pattern name.
       40 : 
       41 :         <ul class="navbar-nav ml-auto">
       42 :           {% if user.is_authenticated %}
       43 :             <li
       44 :             {% if 'dashboard' in request.path %}
       45 :               class="nav-item active mr-3"
       46 :             {% else %}
       47 :               class="nav-item mr-3"
       48 :             {% endif %}
       49 :             >
       50 :               <a class="nav-link" href=" {% url 'dashboard' %} ">
       51 :                 Welcome {{ user.username }}, "Dashboard" </a>
       52 :             </li>
       53 :             <li class="nav-item mr-3" >
       54 :               <a href="javascript:{document.getElementById('logout').submit()}" class="nav-link">
       55 :                 <i class="fas fa-sign-out-alt"></i> Logout
       56 :               </a>
       57 :               <form action="{% url 'logout' %}" method="POST" id="logout">
       58 :                 {% csrf_token %}
       59 :                 <input type="hidden">
       60 :               </form>
url.py

from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('', include('pages.urls')),
    path('listings/', include('listings.urls')),
    path('admin/', admin.site.urls),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

在模板中,您链接到
{%url'仪表板“%}
,但在
url.py
中,您没有它的路由。您可以这样添加它:

 path('dashboard/', /* dashboard view here */, name='dashboard'), 
或者,如果您有
仪表板
应用程序:

 path('dashboard/', include('pages.urls'), name='dashboard'), 

您能否共享
url.py
和由
/
触发的视图?我们需要您的
url.py
和视图来指出错误。您尚未将该名称“dashboard”设置为相应的url正则表达式和视图。请共享您的
url.py
 path('dashboard/', include('pages.urls'), name='dashboard'),