0% found this document useful (0 votes)
4 views6 pages

Django User Guide

This user guide provides step-by-step instructions for creating and running a simple web page using Django. It covers installation, project and app creation, view and URL configuration, template structure, and running the server. The guide includes specific commands for both Linux and Windows environments.

Uploaded by

paritsingla3
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

Django User Guide

This user guide provides step-by-step instructions for creating and running a simple web page using Django. It covers installation, project and app creation, view and URL configuration, template structure, and running the server. The guide includes specific commands for both Linux and Windows environments.

Uploaded by

paritsingla3
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

User Guide

Creating and Running a Simple Web Page with Django

1. Install Django

Open a terminal (Linux) or Command Prompt / PowerShell (Windows).

Command:

pip install django

Linux (Ubuntu)

Windows
Verify installation:

django-admin --version

2. Create a Django Project

django-admin startproject mysite

cd mysite

3. Create a Django App

python [Link] startapp welcome

4. Register the App

Edit mysite/[Link] and add "welcome" to INSTALLED_APPS.

INSTALLED_APPS = [

"[Link]",

"[Link]",

"[Link]",

"[Link]",

"[Link]",

"[Link]",

"welcome",

]
5. Create a View

Edit welcome/[Link] and add:

from [Link] import render

def home(request):

return render(request, 'welcome/[Link]')

6. Configure Project URLs

Edit mysite/[Link]:

from [Link] import admin

from [Link] import path, include

urlpatterns = [

path('admin/', [Link]),

path('', include('[Link]')),

7. Create App URLs

Create welcome/[Link]:

touch ./welcome/[Link] (Linux)

ni welcome/[Link] (Windows (PowerShell))


Add to welcome/[Link]:

from [Link] import path

from . import views

urlpatterns = [

path('', [Link]),

8. Create Template Folder Structure

 Linux:

mkdir ./welcome/templates

mkdir ./welcome/templates/welcome

 Windows (PowerShell):

md welcome/templates

md welcome/templates/welcome
9. Create HTML File

 Linux:

touch welcome/templates/welcome/[Link]

 Windows (PowerShell):

ni welcome/templates/welcome/[Link]

Add to [Link]:

<!DOCTYPE html>

<html>

<head>

<title>Welcome</title>

</head>

<body>

<h1>Welcome to Django Web Application</h1>

</body>

</html>

10. Run the Server

python [Link] runserver


Open browser:

[Link]

Webpage

You might also like