Thursday, May 2, 2019

problem with url

new to django. so i have an app that displays an html page. i also have a menu on that page that will load up other html pages.
however, when i add the path to urls.py and then the class def in views, it fails. i know it's something simple, what am i missing. 

As I said, the dashboard.html works, i just want another menu option to load the other html file. i have commented this out as it causes my app to break.



urls.py

from django.conf.urls import url
from django.contrib import admin
from django.urls import path

from vr_reporting_app.views import HomeView
from vr_reporting_app.views import Map

urlpatterns = [
    path('', HomeView.as_view(), name='home'),    #points to the view in views.py 
    #path('map/', Map.as_view(), name='map'),                                                          
    path('admin/', admin.site.urls),
]


views.py

from django.shortcuts import render
from django.views.generic.base import TemplateView

class HomeView(TemplateView):
template_name = 'dashboard.html'

class Map(TemplateView):
template_name = 'map.html'

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/56e4f189-fbaf-41f5-bc33-86c5d959192c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment