更新的django ...我正在尝试在我的django应用程序中新的html页面,它似乎没有呈现。我收到了404错误。
我已经使用这种方法成功添加了其他页面,但由于某种原因它不再起作用了。
我采取的步骤:
故障排除:
views.py
from django.http import HttpResponse
from django.conf import settings
from django.views.generic import View
from django.shortcuts import render
from django.contrib.auth.models import User
#from Minerva.backend.backend import CustomLDAPAuthBackend
from django.contrib.auth.backends import RemoteUserBackend
import logging
#logger = logging.getLogger(__name__)
## Main Dashboard page
class DashboardsView(View):
def get(self, request):
return render(request, "Dashboards.html")
## Documentation
class DocumentationView(View):
def get(self, request):
return render(request, "Documentation.html")
urls.py
from django.conf.urls import url
from Dashboards.views import DashboardsView
from Dashboards.views import AmbulatoryQualityView, CancerCenterView, DecisionSupportView
from Dashboards.views import EnterpriseQualityView, HumanResourcesView, IPAnalyticsView, ManagedCareView, DocumentationView
from django.views.generic import TemplateView
app_name = 'Dashboards'
urlpatterns = [
url(r'^$', DashboardsView.as_view(), name='Dashboards'),
url(r'^/Ambulatory Quality$', AmbulatoryQualityView.as_view()),
url(r'^/Cancer Center Service Line$', CancerCenterView.as_view()),
url(r'^/Decision Support$', DecisionSupportView.as_view()),
url(r'^/Enterprise Quality$', EnterpriseQualityView.as_view()),
url(r'^/Human Resources$', HumanResourcesView.as_view()),
url(r'^/IP_Analytics$', IPAnalyticsView.as_view()),
url(r'^/Managed Care$', ManagedCareView.as_view()),
url(r'^/Documentation$', DocumentationView.as_view()),
]
答案 0 :(得分:0)
它与你的urlpatterns中没有任何关系,首先r^/Documentations$
应该是r^Documentation/$
,不要在你的URL中使用大写字母,不要在你使用空格时想要长网址,r'^/Cancer Center Service Line$'
将为r'^cancer-center-service-line/$'
,等等。