Create a new Django app: This generates the necessary files for your app. Create a view: This defines a function that handles requests and returns a response. Create a template: This defines the HTML structure of your page. Update urls.py: This maps URLs to views in your project. To run this app: Start the development server: python manage.py runserver Open your web browser and go to http://127.0.0.1:8000/ You should see the message "Hello, World!" displayed on your page..
# Create a new Django app
python manage.py startapp myapp
# Create a view in myapp/views.py
from django.shortcuts import render
def index(request):
context = {'name': 'World'}
return render(request, 'myapp/index.html', context)
# Create a template in myapp/templates/myapp/index.html
<!DOCTYPE html>
<html>
<head>
<title>Hello, World!</title>
</head>
<body>
<h1>Hello, {{ name }}!</h1>
</body>
</html>