Sure.
Here is my 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 Local
from vr_reporting_app.views import User
from vr_reporting_app.views import School
urlpatterns = [
path('', HomeView.as_view(), name='home'),
path('User/', User.as_view(), name='user'),
path('Local/', Local.as_view(), name='local'),
path('School/', School.as_view(), name='school'),
path('admin/', admin.site.urls),
]
Here is my view.py
from django.shortcuts import render
from django.views.generic.base import TemplateView
class HomeView(TemplateView):
template_name = 'dashboard.html'
class Local(TemplateView):
template_name = 'local.html'
class User(TemplateView):
template_name = 'user.html'
class School(TemplateView):
template_name = ‘schoolreporting.html'
Also had to add {% load staticfiles %} to my html pages
And added a tag to each css reference.
<link href="{% static 'demo/demo.css' %}" rel="stylesheet" />
> On May 3, 2019, at 2:23 PM, anchal agarwal <[email protected]> wrote:
>
> I am also facing the same issue ,can you tell me how you resolved this issue?
> On 03-May-2019 9:57 pm, <[email protected]
> <mailto:[email protected]>> wrote:
> >
> > I resolved this.
> >
> >
> > On Thursday, May 2, 2019 at 5:21:59 PM UTC-4, [email protected]
> > <mailto:[email protected]> wrote:
> >>
> >> 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 [email protected]
> > <mailto:django-users%[email protected]>.
> > To post to this group, send email to [email protected]
> > <mailto:[email protected]>.
> > Visit this group at https://groups.google.com/group/django-users
> > <https://groups.google.com/group/django-users>.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/django-users/1e5029d2-a431-4c60-95ec-5ffedb11c124%40googlegroups.com
> >
> > <https://groups.google.com/d/msgid/django-users/1e5029d2-a431-4c60-95ec-5ffedb11c124%40googlegroups.com>.
> >
> > For more options, visit https://groups.google.com/d/optout
> > <https://groups.google.com/d/optout>.
>
>
> --
> 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 [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/django-users
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMT%3DisXmbb6S1S6jjkowmgPfKjCYtF%2BPyYca9kOA5ZAdyi23zg%40mail.gmail.com
>
> <https://groups.google.com/d/msgid/django-users/CAMT%3DisXmbb6S1S6jjkowmgPfKjCYtF%2BPyYca9kOA5ZAdyi23zg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
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 [email protected].
To post to this group, send email to [email protected].
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/5C5A0328-5E5A-4FF5-9658-D7F6B15122DF%40gmail.com.
For more options, visit https://groups.google.com/d/optout.