Create Pages App
-
Stop the server
-
Create an app python manage.py startapp pages
-
In pages app create a view by editing the file view.py
from django.shortcuts import render
def index(request):
return render(request, 'pages/index.html')
Create URLs (Routing)
4. Create urls.py file
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
5. Edit the main urls.py file and add
path('', include('pages.urls')),
Create the template
6. Create the template, in templates create a folder for pages and create index.html file
{% endblock %}
7. Run the server python manage.py runserver