Step 1: Create a project
django-admin startproject hello_world_project
Step 2: Change directory to hello_world_project
cd hello_world_project
Step 3: Create a new file views.py and write the function view for hello world
from django.shortcuts import HttpResponse
#views.py:
#hello world view
def hello_world(request):
return HttpResponse("Hello World")
Step 4: Edit the urls.py file to route the url for hello world view
#urls.py:
from django.contrib import admin
from django.urls import path
from .views import hello_world
urlpatterns = [
path('admin/', admin.site.urls),
path('', hello_world, name="hello-world")
]
Step 4: Run the server using python manage.py runserver command
python manage.py runserver
The above steps are the simplest way to write a hello world program in Django.