Professional Documents
Culture Documents
Internship Training 3
Internship Training 3
Internship Training 3
Internship Training
2
What is Django?
◦ Django is basically highly python web application frame work that enables
the rapid development of web applications.
◦ Open-source Python frameworks.
3
Why Django is Used?
◦ It’s fast and simple
◦ It’s secure
◦ It’s well-established
◦ Packaging System
4
Django Setup
◦ First of all install python.
◦ For creating new project first of all create folder in local drive.
5
Step 2: Open the folder in vs code.
6
7
8
Step 3: click Terminal and select New Terminal.
9
Step4: check the python version by typing Python --version in terminal and
press enter.
10
Step 5: To install env type pip install pipenv
11
Step 6: pipenv shell to activate virtual environment
12
Step 7: py –m venv env for creating env
13
Step 9: env\scripts\activate for activating env
14
Step 10: pip install django to install django
15
Step 11: django admin startproject iv (iv - project name)
Project name
16
Step12: cd projectname (cd iv). For entering in to the project . then press enter.
17
Step 13: then enter python manage.py runserver.
18
Step 14:- press control and click on the http link. to change the port number :
python manage.py runserver (the number you want)
19
Step 15: create the app : python manage.py startapp djangoapp
App name
20
App name
Project name
21
Step 16: add the app name to the installed apps in settings.py
22
Step 17: create urls.py file in app and copy urls from project.
23
Step 17: urls.py of project changed, import include.
24
Step 19: create templates folder in app to store html files and Inside the
template folder another folder is created. Html files are stored inside new folder.
Folder
name
Html page
25
Step 20: static folder also created . Separate folder of css, js, images are stored
inside static folder.
To store images
26
Step 21: pip install mysqlclient
27
Step 22: Create a new schema in MySQL Database.
28
Step 23: go to settings and change databases
29
Step 24: go to settings and give DIRS for templates, then add import os
30
Step 25: create register.html in templates
31
32
33
34
35
36
37
38
Step 25: changes made in models.py in app according to register page.
39
40
41
Step 25: changes made in views.py in app according to register page.
42
Step 25: changes made in urls.py in app according to register page.
43
Step 26: type python manage.py makemigrations djangoapp and then migrate
by using python mange.py migrate. After migrations the table is created in
database.
44
Table name
45
46
Step 27: then enter python manage.py runserver and then press control and
click on the http link. Register page will display
47
Step 27: then fill the register page and then click the submit button, the entered
values will displayed in database.
48
49
50
51
52