Setting up django project and creating home page.

In this tutorial we will start by creating a django project then we will create an accounts app in it. In this accounts app we will create our home page template.

We will start by creating a django project "website".

django-admin startproject website


Open the website folder and create "accounts" app.

python startapp accounts


Add accounts app in installed apps in


Edit website as below

from django.contrib import admin

from django.urls import path,include

urlpatterns = [





In accounts, create file and add following code.

from django.urls import path

from . import views

urlpatterns = [




In file of accounts we will define a home function.

from django.shortcuts import render

def home(request):

    return render(request,'accounts/home.html')


In accounts, create a folder and name it as templates, inside this templates folder create a folder and name it as accounts. In this accounts folder create an html file and name it as home.html. Add following html code in home.html file.






<body align="center">


  <h2>This is our home page</h2>




Now runserver with following command

python runserver

Now visit Home page will look like below.

Published : July 18, 2020