SlideShare a Scribd company logo
Intro to Web Development
Using Python and Django
October 2017
Chariza Pladin
chariza.b.pladin@accenture.com
Chariza Baclor Pladin
2
- Bachelor of Science in Information
Technology (2014)
- I.T Instructor
- Data Analyst / Mobile App QA
Accenture Inc.
● Introduction to Python
● Hello, Django
● Setting up Our First Django
App
● Creating and Populating
Database
● URLs and Views
● Q/A
Course Outline
3
Seminar Schedule
1 Hour Discussion
4
3 Hours Code Labs
● Understand agenda’s outline
● Know and be familiarized
with some basic concept
about Python programming
language
● Write simple Python
program and
Django-powered web
page/sites
Outcomes
5
Introduction to
Python
6
Python
is your
friend.
7
Hello, Django
8
DJANGO
● A high-level Python web Framework
● Encourages rapid development, clean and pragmatic
design
● ‘For perfectionists with deadlines’
● ‘Focuses and automation and DRY’
● Widely supported and has many deployment options.
9
/Why choose
Django?/
10
Why use Django?
● The framework has templates, libraries and API designed to
work together for natural growth and connectivity.
● Django suits projects of any size, from small to the biggest
ones.
● Django uses Python which was one of the most popular
programming languages of 2015, and is now the most
popular language for those learning to code.
11
Why use Django?
● Django is a more fully featured kit than most of other
frameworks, it contains everything you need to build an app.
● Django adheres to D.R.Y. — Don’t Repeat Yourself —
philosophy. That means that the framework places a premium
on getting the absolute most out of very little code.
12
Why use Django?
13
Setting up
and
Basic Requirements
14
Requirements and Downloads
https://www.python.org/downloads/
15
Requirements and Downloads
https://www.jetbrains.com/pycharm/
16
Virtual Environment
- An isolated working copy of Python which allows you
to work on a specific project without worry of
affecting other projects It enables multiple
side-by-side installations of Python, one for each
project.
Install Virtual Environment
Command:
pip3 install virtualenv
17
Virtual Environment (cont.)
Create Virtual Environment
Command:
virtualenv -p python3 env
Virtual
environment
name
18
Virtual Environment (cont.)
Activate Virtual Environment
Command:
source env/bin/activate
19
Modify Pycharm Interpreter
Change Interpreter settings
● Preferences
○ Project First Project
■ Project Interpreter
● Name of virtual environment
20
Install Django
Command:
pip install django
21
Create our first
Django Web App
22
Create Web App
Command:
django-admin startproject <project_name>
Example:
django-admin startproject mysite
23
Create Web App(cont.)
24
Mysite - Components
25
● manage.py - lets app creator talk through terminal/shell.
● __init__.py - tells file is a python package.
● settings.py - holds the setting configuration of all the app
inside the web app.
● urls.py - has the access and settings of any url used.
● wsgi.py - used to deploy web app to a server.
Create Web App(cont.)
26
Main Website
App 1 App 2 App nth
Create Polls App
27
Create Polls App
28
Command:
python manage.py startapp polls
Important Note
Always make sure to check active directory
(before executing code) which is the
<project_name> directory.
Polls App(cont.)
29
Polls Directory - Components
30
● admin.py - -allows user to add features in the admin page
● __init__.py - tells file is a python package.
● apps.py - used to configure apps.
● models.py - database layout.
● tests.py - used to app testing.
● views.py - used to display database content.
First run Server
31
Command:
python manage.py runserver
First run Server(cont.)
32
Adding Models
33
Models
34
Object-oriented programming (OOP) is a style
of programming that focuses on using objects
to design and build applications.
Models(cont.)
35
Models - Polls
36
Question Choice
Number of
Votes
Choice TextPublish Date
Question
Text
Link
Creating the Models
37
Make Migrations
38
Command:
python manage.py makemigrations polls
Python manage.py migrate
Important Note
Go to settings.py under the <project_name>
and don’t forget to add ‘polls’.
Make Migrations(cont.)
39
What’s the use of Migration?
Migrations are Django’s way of propagating
changes you make to your models (adding a field,
deleting a model, etc.)
Make Migrations
40
Make Migrations(cont.)
41
Populating Database
42
Open Python Shell
43
The Python interactive console (also called the Python
interpreter or Python shell) provides programmers with a
quick way to execute commands and try out or test code
without creating a file.
Command:
python manage.py shell
Populating Database - Add a Question
44
Populating Database(cont.) - Display Question and Choice Objects
45
Populating Database - Add Choices
46
Django Admin Tool
47
Admin Tool
48
Command:
python manage.py createsuperuser
Python manage.py runserver
Important Note
This command will prompt asking for
username, email address and a password.
Admin Tool(cont.)
49
Admin Tool(cont.)
50
Adding Database files to Admin Tool
51
Open admin.py
Adding Database files to Admin Tool(cont.)
52
Adding Database files to Admin Tool(cont.)
53
Adding Database files to Admin Tool(cont.)
54
Adding Database files to Admin Tool(cont.)
55
Playing with URLs
56
URLs and Views
57
2 step process to display data:
1. Link urls.py in the main directory to the new urls.py in
the poll directory.
2. Link views.py to the file.
Create New URL
58
Create New URL
59
Open mysite directory > urls.py
Step 2:
Create a
new urls.py
inside polls
directory
60
Configure new urls.py
61
Open polls directory > urls.py
HTTP Response
62
Django uses request and response objects to pass state
through the system.
When a page is requested, Django creates an HttpRequest
object that contains metadata about the request. Then Django
loads the appropriate view, passing the HttpRequest as the
first argument to the view function. Each view is responsible
for returning an HttpResponse object.
Configure views.py
63
Open polls directory > views.py
Then run the server again
Command:
python manage.py runserver
Configure views.py
64
Setting up views
65
Setting up views
66
Open polls directory > views.py
Linking views to URLs
67
Open polls directory > urls.py
Display Questions from database
68
Open polls directory > views.py
Creating Templates
69
Django Templates
70
Django’s template engine provides a
powerful mini-language for defining the
user-facing layer of your application,
encouraging a clean separation of
application and presentation logic.
71Creating Templates
72Creating Templates(cont.)
73Creating Templates(cont.)
Django Templates(cont.)
74
Important Note:
Django Template Language use different coding syntax
for loops and variables.
{% %} - used for loops.
{{ }} - used for variables
Django Templates(cont.)
75
Step 1: Create the template
Django Templates(cont.)
76
Step 1: Rendering templates
Quick Links
77
● https://www.djangoproject.com/
● https://github.com/django/django
● https://djangobook.com/
● https://www.fullstackpython.com/django.html
● https://djangopackages.org/
Quick Links(cont.)
78
https://www.edx.org/
Quick Links(cont.)
79
Sharing is
caring...
80
FREE PDFS!
81
Thank
you :)
82
Send me feedback :)

More Related Content

PDF
Microservices with Java, Spring Boot and Spring Cloud
Eberhard Wolff
 
PDF
Django Introduction & Tutorial
之宇 趙
 
KEY
Introduction to Django
James Casey
 
PPTX
Python/Flask Presentation
Parag Mujumdar
 
ODP
Introduction to Structured Streaming
Knoldus Inc.
 
PDF
Introduction to Spark with Python
Gokhan Atil
 
PDF
Building an analytics workflow using Apache Airflow
Yohei Onishi
 
PDF
Redash: Open Source SQL Analytics on Data Lakes
Databricks
 
Microservices with Java, Spring Boot and Spring Cloud
Eberhard Wolff
 
Django Introduction & Tutorial
之宇 趙
 
Introduction to Django
James Casey
 
Python/Flask Presentation
Parag Mujumdar
 
Introduction to Structured Streaming
Knoldus Inc.
 
Introduction to Spark with Python
Gokhan Atil
 
Building an analytics workflow using Apache Airflow
Yohei Onishi
 
Redash: Open Source SQL Analytics on Data Lakes
Databricks
 

What's hot (20)

PPTX
Azure cosmos db, Azure no-SQL database,
BRIJESH KUMAR
 
PDF
Introduction to Azure Data Factory
Slava Kokaev
 
PDF
Building a Data Pipeline using Apache Airflow (on AWS / GCP)
Yohei Onishi
 
PPT
Introduction to the Web API
Brad Genereaux
 
PPTX
Azure data factory
David Giard
 
PPT
MYSQL.ppt
webhostingguy
 
PPTX
Django - Python MVC Framework
Bala Kumar
 
ODP
Django for Beginners
Jason Davies
 
PDF
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
Arawn Park
 
PPTX
Snowflake Architecture.pptx
chennakesava44
 
PDF
Introduction to Azure Synapse Webinar
Peter Ward
 
PPTX
An Introduction To NoSQL & MongoDB
Lee Theobald
 
PPTX
Flask
Mamta Kumari
 
PDF
Big Query Basics
Ido Green
 
PDF
Exploring BigData with Google BigQuery
Dharmesh Vaya
 
PPTX
Airflow - a data flow engine
Walter Liu
 
PPTX
Introduction to NoSQL
Dr-Dipali Meher
 
PPTX
Azure data factory
BizTalk360
 
PPT
Introduction to MongoDB
Ravi Teja
 
PDF
Data Lineage with Apache Airflow using Marquez
Willy Lulciuc
 
Azure cosmos db, Azure no-SQL database,
BRIJESH KUMAR
 
Introduction to Azure Data Factory
Slava Kokaev
 
Building a Data Pipeline using Apache Airflow (on AWS / GCP)
Yohei Onishi
 
Introduction to the Web API
Brad Genereaux
 
Azure data factory
David Giard
 
MYSQL.ppt
webhostingguy
 
Django - Python MVC Framework
Bala Kumar
 
Django for Beginners
Jason Davies
 
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
Arawn Park
 
Snowflake Architecture.pptx
chennakesava44
 
Introduction to Azure Synapse Webinar
Peter Ward
 
An Introduction To NoSQL & MongoDB
Lee Theobald
 
Big Query Basics
Ido Green
 
Exploring BigData with Google BigQuery
Dharmesh Vaya
 
Airflow - a data flow engine
Walter Liu
 
Introduction to NoSQL
Dr-Dipali Meher
 
Azure data factory
BizTalk360
 
Introduction to MongoDB
Ravi Teja
 
Data Lineage with Apache Airflow using Marquez
Willy Lulciuc
 
Ad

Viewers also liked (14)

PDF
Ebriks-An idea to change your bussiness growth
ebriksinfotech
 
PPTX
Peer to-peer mobile payments
Ishraq Al Fataftah
 
PDF
LED Display Boards - (Moving LED Display)
Organized Outdoor Options
 
PDF
Top Libraries for Machine Learning with Python
Chariza Pladin
 
PPTX
Display Advertising's New Wave
Jonathan Mendez
 
PDF
Approved budget Fiscal Year 2018
Houston Community College
 
PPT
Open Source Software in Libraries
Sukhdev Singh
 
PPSX
2018 Sony World Photography Awards: Featured Entries (1)
maditabalnco
 
PDF
Game Development With Python and Pygame
Chariza Pladin
 
PDF
Roadmap for landing a role at a Tech Startup
Panji Gautama
 
PDF
How tech can spark social change
Anne-Marie Elias
 
PDF
Free & Open Source Software (2017 update)
Frederik Questier
 
PDF
Data Analysis and Visualization using Python
Chariza Pladin
 
PDF
Open Source Software and Libraries
Ellyssa Kroski
 
Ebriks-An idea to change your bussiness growth
ebriksinfotech
 
Peer to-peer mobile payments
Ishraq Al Fataftah
 
LED Display Boards - (Moving LED Display)
Organized Outdoor Options
 
Top Libraries for Machine Learning with Python
Chariza Pladin
 
Display Advertising's New Wave
Jonathan Mendez
 
Approved budget Fiscal Year 2018
Houston Community College
 
Open Source Software in Libraries
Sukhdev Singh
 
2018 Sony World Photography Awards: Featured Entries (1)
maditabalnco
 
Game Development With Python and Pygame
Chariza Pladin
 
Roadmap for landing a role at a Tech Startup
Panji Gautama
 
How tech can spark social change
Anne-Marie Elias
 
Free & Open Source Software (2017 update)
Frederik Questier
 
Data Analysis and Visualization using Python
Chariza Pladin
 
Open Source Software and Libraries
Ellyssa Kroski
 
Ad

Similar to Intro to Web Development Using Python and Django (20)

PPTX
Django framework
TIB Academy
 
PDF
An Introduction to Django Web Framework
David Gibbons
 
DOCX
Akash rajguru project report sem v
Akash Rajguru
 
PDF
EuroPython 2013 - Python3 TurboGears Training
Alessandro Molina
 
PPTX
Django
Sayeed Far Ooqui
 
PDF
Django interview Questions| Edureka
Edureka!
 
PDF
Django
Ksd Che
 
DOCX
Company Visitor Management System Report.docx
fantabulous2024
 
PPTX
Django Architecture Introduction
Haiqi Chen
 
PDF
Let's build Developer Portal with Backstage
Opsta
 
PDF
Web development django.pdf
KomalSaini178773
 
PDF
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Pantheon
 
PDF
Introduction to Django
Jagdeep Singh Malhi
 
PDF
Best data analyst course syllabus 2025.pdf
mayra0232020
 
PPTX
Django Portfolio Website Workshop (1).pptx
AmaraCostachiu
 
PPTX
Django rest framework
Blank Chen
 
PDF
CollegeDiveIn presentation
Karambir Singh Nain
 
ODP
Moodle Development Best Pracitces
Justin Filip
 
PDF
DevOps for TYPO3 Teams and Projects
Fedir RYKHTIK
 
Django framework
TIB Academy
 
An Introduction to Django Web Framework
David Gibbons
 
Akash rajguru project report sem v
Akash Rajguru
 
EuroPython 2013 - Python3 TurboGears Training
Alessandro Molina
 
Django interview Questions| Edureka
Edureka!
 
Django
Ksd Che
 
Company Visitor Management System Report.docx
fantabulous2024
 
Django Architecture Introduction
Haiqi Chen
 
Let's build Developer Portal with Backstage
Opsta
 
Web development django.pdf
KomalSaini178773
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Pantheon
 
Introduction to Django
Jagdeep Singh Malhi
 
Best data analyst course syllabus 2025.pdf
mayra0232020
 
Django Portfolio Website Workshop (1).pptx
AmaraCostachiu
 
Django rest framework
Blank Chen
 
CollegeDiveIn presentation
Karambir Singh Nain
 
Moodle Development Best Pracitces
Justin Filip
 
DevOps for TYPO3 Teams and Projects
Fedir RYKHTIK
 

More from Chariza Pladin (7)

PDF
Day 4 - Advance Python - Ground Gurus
Chariza Pladin
 
PPTX
Ground Gurus - Python Code Camp - Day 3 - Classes
Chariza Pladin
 
PDF
AI - The Good, Bad and scary truth of Super Intelligence
Chariza Pladin
 
PDF
Computer vision and Open CV
Chariza Pladin
 
PDF
Ground Gurus Introduction
Chariza Pladin
 
PDF
Introduction to Machine learning with Python
Chariza Pladin
 
PDF
Zero to Hero - Introduction to Python3
Chariza Pladin
 
Day 4 - Advance Python - Ground Gurus
Chariza Pladin
 
Ground Gurus - Python Code Camp - Day 3 - Classes
Chariza Pladin
 
AI - The Good, Bad and scary truth of Super Intelligence
Chariza Pladin
 
Computer vision and Open CV
Chariza Pladin
 
Ground Gurus Introduction
Chariza Pladin
 
Introduction to Machine learning with Python
Chariza Pladin
 
Zero to Hero - Introduction to Python3
Chariza Pladin
 

Recently uploaded (20)

PPTX
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PDF
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPT
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
Autodock-for-Beginners by Rahul D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Trends in pediatric nursing .pptx
AneetaSharma15
 
PDF
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
PDF
UTS Health Student Promotional Representative_Position Description.pdf
Faculty of Health, University of Technology Sydney
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PDF
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
PPTX
FSSAI (Food Safety and Standards Authority of India) & FDA (Food and Drug Adm...
Dr. Paindla Jyothirmai
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Autodock-for-Beginners by Rahul D Jawarkar.pptx
Rahul Jawarkar
 
Trends in pediatric nursing .pptx
AneetaSharma15
 
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
UTS Health Student Promotional Representative_Position Description.pdf
Faculty of Health, University of Technology Sydney
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
FSSAI (Food Safety and Standards Authority of India) & FDA (Food and Drug Adm...
Dr. Paindla Jyothirmai
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 

Intro to Web Development Using Python and Django