...

/

Homepage View and Template

Homepage View and Template

Learn how to complete the Homepage implementation by creating a view and template.

We'll cover the following...

Homepage view

After we create the URL for a specific page, a view for the page also needs to be created.

Add the following code in views.py in the app’s directory to create the view for the Homepage.

Press + to interact
from django.shortcuts import render
def index(request):
return render(request, 'listings/index.html')

The module in line 1 is used to call different helper functions. We use it here to call render (line 4) which helps generate a response that we can render in a ...