Reputation: 9
Django question here: So I was trying to get some html files to work through templates. I put this in the views.py file:
def about (request):
return render(request, 'about.html')
def contact (request):
return render(request, 'contact.html')
def pricing (request):
return render(request, 'pricing.html')
def faq (request):
return render(request, 'faq.html')
and this in the urls.py file:
path('about', views.about, name='about'),
path('contact', views.contact, name='contact'),
path('pricing', views.pricing, name='pricing'),
path('faq', views.faq, name='faq'),
]
Yet when I try to go there through the home page, it doesn't work and I get this: Error page
Does anyone know how to fix this?!?!!! My templates folder and manage.py are in the same folder
Upvotes: 1
Views: 31
Reputation: 9
Ok, so the issue I had was that I was href-ing 'about.html' and not just 'about' in my index.html file
I changed that and it worked!
Upvotes: 0
Reputation: 10015
The urlconf you have is missing slashes at the end of each pattern, but the main issue you have is that your about page is to be accessed by:
http://127.0.0.1:8000/about/
Upvotes: 1