0% found this document useful (0 votes)
7 views3 pages

26 Feb Start 2025 Batch230

The document outlines a step-by-step guide for setting up a Django project, including creating a project folder, installing Django, and configuring the project settings. It details the creation of views, templates, and URL routing for a basic web application with home, about, and contact pages. Additionally, it includes instructions for integrating Bootstrap for styling the web pages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

26 Feb Start 2025 Batch230

The document outlines a step-by-step guide for setting up a Django project, including creating a project folder, installing Django, and configuring the project settings. It details the creation of views, templates, and URL routing for a basic web application with home, about, and contact pages. Additionally, it includes instructions for integrating Bootstrap for styling the web pages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

******************************26 feb start 2025*******************************

step1 make folder in any drive

step2 open pycharm

step3 open terminal

step4 terminal
pip install django

step5 terminal
django-admin startproject myproject

step6 put your project inside drive folder


cd myproject

step7 terminal
python manage.py startapp myapp

step8 run server


python manage.py runserver

step9 open browser


localhost:8000

******************27 feb 2025****************************************


step1 myproject/settings.py

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
]

step2 myproject/urls.py

from django.contrib import admin


from django.urls import path,include

urlpatterns = [
path('admin/', admin.site.urls),
path('', include('myapp.urls'))
]

step3myapp/urls.py

from django.urls import path


from .import views
urlpatterns = [

path('',views.home,name='home')
]
step4myapp/views.py
from django.shortcuts import render

# Create your views here.


def home(request):
return render(request,'myapp/home.html')

step5 myapp/templates/myapp/home.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>welcome all of you</h1>
</body>
</html>

step6
python manage.py runserver

step1

myapp---->new---html(click)----about.html
myapp---->new---html(click)----contact.html
myapp---->new---html(click)----base.html
myapp---->new---html(click)----navbar.html

step2 base.html

paste bootstrap coding

step3 navbar.html

paste navbar coding in bootstrap

step4 edit base.html

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous">
</head>
<body>
{% include 'myapp/navbar.html' %}
{% block content %}

{% endblock %}
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
</body>
</html>

step 5 home.html
{% extends 'myapp/base.html' %}
{% block content %}
<h1>welcome home page</h1>
{% endblock %}

step6 about.html
{% extends 'myapp/base.html' %}
{% block content %}
<h1>welcome about page</h1>
{% endblock %}

step7 contact.html
{% extends 'myapp/base.html' %}
{% block content %}
<h1>welcome contact page</h1>
{% endblock %}

******************************5 march 2025***************************


step1 myapp/urls.py
from django.urls import path
from . import views

urlpatterns = [

path('', views.home, name='home'),


path('about/', views.about, name='about'),
path('contact', views.contact, name='contact')
]

step2 myapp/views.py
from django.shortcuts import render

# Create your views here.


def home(request):
return render(request,'myapp/home.html')
def about(request):
return render(request,'myapp/about.html')
def contact(request):
return render(request,'myapp/contact.html')

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy