How to make a simple website in Django: a python web framework.

In this article we presume that you have python and django installed in your system. First we will make a django project and name it website and under this project we will create an app and will name it hello.


1. Open your command terminal in any location in your system where you want to make this project and type below command to make  a project with name website.

    django-admin startproject website

    a folder with website name will be created and the directory layout will look similar to below image.



2. Inside this folder you will see a python file named "". This will help us to execute several commands, some of these we  will use in this project.

    Inside website folder again open the command terminal and enter below command to create an app with name hello

    python startapp hello

    now the directory will look like this



    make sure the above command is executed in the folder where file is located else you will get below error.

    python: can't open file '': [Errno 2] No such file or directory


3. Inside your main website folder get into the website folder and open and delete all the content and type in below content and  save it.

from django.contrib import admin

from django.urls import path,include

urlpatterns = [





4. Now go to your hello folder inside the main website folder and create a file in this folder(make sure the file has .py extension)  and inside this file add below code

from django.urls import path

from . import views

urlpatterns = [




5. now go to your file inside your hello folder under main website folder and add below code

from django.http import HttpResponse

def home(request):

    return HttpResponse("Hello World")


6. Now the coding part is over, we need to run our local server. To do this, open the command prompt in your main website folder where file is located and type in below command.

python runserver

this command will run our server and we will get below output in our command prompt.

In this output we can see that our server is running at . Keep this prompt open, if you close this prompt it will close our server too.

Now copy and paste it in your browser url. You will see below result.




With this our objective for this article is accomplished. You may not understand it completely and keeping this in mind we have published below article explaining all of the above steps in detail.

How to make a simple website in django (Part 2 : Explanation)

Please visit the above link if you had any difficulty in understanding any of the above steps. Good bye for now.

Published : June 20, 2020