Articles → DJANGO → Create Our First Function-Based View In Django

Create Our First Function-Based View In Django

What Is Function-Based View?

Create Your First Function-Based View

  1. Go to TestModule folder.
  2. Open and add a new function
  3. from django.http import HttpResponse
    from django.shortcuts import render
    # Create your views here.
    def home(request):
      return HttpResponse("Hello")

  4. Go to (root_folder/
  5. Add the following code in
from django.contrib import admin
from django.urls import path
from TestModule.views import home

urlpatterns = [
  path('', home),


<python_path>\python runserver 8080

Picture showing the output of the first function-based view in django
Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Sunday, June 9, 2019


Your Email Id  
Query/FeedbackCharacters remaining 250