Skip to content

Adding a Webpage

Paige Maute edited this page Oct 13, 2021 · 9 revisions

How to add a webpage

  1. Create the html file under templates. Project pages and other sub pages will be in certain folders. Ex: test.html

  2. Create the views class under django_project -> views.py the views class template_name should have the exact same html file name. Sub pages will be in their own views.py like projects -> views.py

class TestPage(TemplateView):
    template_name = 'test.html'
  1. Create the path for the webpage in django_project -> urls.py then under urlpatterns add the path using the same exact name you used for the views class: path('test/', views.TestPage.as_view(), name='test'),

  2. Then you are set to add the webpage where you want "{% url 'example' %}"

Clone this wiki locally