SlideShare a Scribd company logo
1 of 82
Download to read offline
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

What's hot

A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django Introduction
Ganga Ram
 

What's hot (20)

A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django Introduction
 
Django
DjangoDjango
Django
 
django
djangodjango
django
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Django Girls Tutorial
Django Girls TutorialDjango Girls Tutorial
Django Girls Tutorial
 
Introduction to django framework
Introduction to django frameworkIntroduction to django framework
Introduction to django framework
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
DJango
DJangoDJango
DJango
 
Django
DjangoDjango
Django
 
Django interview Questions| Edureka
Django interview  Questions| EdurekaDjango interview  Questions| Edureka
Django interview Questions| Edureka
 
Django, What is it, Why is it cool?
Django, What is it, Why is it cool?Django, What is it, Why is it cool?
Django, What is it, Why is it cool?
 
Python/Flask Presentation
Python/Flask PresentationPython/Flask Presentation
Python/Flask Presentation
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction Django
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Python/Django Training
Python/Django TrainingPython/Django Training
Python/Django Training
 
Python pandas Library
Python pandas LibraryPython pandas Library
Python pandas Library
 
Pandas
PandasPandas
Pandas
 
Rest api with Python
Rest api with PythonRest api with Python
Rest api with Python
 
pandas - Python Data Analysis
pandas - Python Data Analysispandas - Python Data Analysis
pandas - Python Data Analysis
 

Viewers also liked

Viewers also liked (14)

Ebriks-An idea to change your bussiness growth
Ebriks-An idea to change your bussiness growthEbriks-An idea to change your bussiness growth
Ebriks-An idea to change your bussiness growth
 
Peer to-peer mobile payments
Peer to-peer mobile paymentsPeer to-peer mobile payments
Peer to-peer mobile payments
 
LED Display Boards - (Moving LED Display)
LED Display Boards - (Moving LED Display) LED Display Boards - (Moving LED Display)
LED Display Boards - (Moving LED Display)
 
Top Libraries for Machine Learning with Python
Top Libraries for Machine Learning with Python Top Libraries for Machine Learning with Python
Top Libraries for Machine Learning with Python
 
Display Advertising's New Wave
Display Advertising's New WaveDisplay Advertising's New Wave
Display Advertising's New Wave
 
Approved budget Fiscal Year 2018
Approved budget Fiscal Year 2018Approved budget Fiscal Year 2018
Approved budget Fiscal Year 2018
 
Open Source Software in Libraries
Open Source Software in LibrariesOpen Source Software in Libraries
Open Source Software in Libraries
 
2018 Sony World Photography Awards: Featured Entries (1)
2018  Sony World Photography Awards: Featured Entries (1)2018  Sony World Photography Awards: Featured Entries (1)
2018 Sony World Photography Awards: Featured Entries (1)
 
Game Development With Python and Pygame
Game Development With Python and PygameGame Development With Python and Pygame
Game Development With Python and Pygame
 
Roadmap for landing a role at a Tech Startup
Roadmap for landing a role at a Tech StartupRoadmap for landing a role at a Tech Startup
Roadmap for landing a role at a Tech Startup
 
How tech can spark social change
How tech can spark social change   How tech can spark social change
How tech can spark social change
 
Free & Open Source Software (2017 update)
Free & Open Source Software (2017 update)Free & Open Source Software (2017 update)
Free & Open Source Software (2017 update)
 
Data Analysis and Visualization using Python
Data Analysis and Visualization using PythonData Analysis and Visualization using Python
Data Analysis and Visualization using Python
 
Open Source Software and Libraries
Open Source Software and LibrariesOpen Source Software and Libraries
Open Source Software and Libraries
 

Similar to Intro to Web Development Using Python and Django

DevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and ProjectsDevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and Projects
Fedir RYKHTIK
 

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

Django framework
Django framework Django framework
Django framework
 
An Introduction to Django Web Framework
An Introduction to Django Web FrameworkAn Introduction to Django Web Framework
An Introduction to Django Web Framework
 
Akash rajguru project report sem v
Akash rajguru project report sem vAkash rajguru project report sem v
Akash rajguru project report sem v
 
EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears Training
 
Django
DjangoDjango
Django
 
Django
DjangoDjango
Django
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docx
 
Django Architecture Introduction
Django Architecture IntroductionDjango Architecture Introduction
Django Architecture Introduction
 
Let's build Developer Portal with Backstage
Let's build Developer Portal with BackstageLet's build Developer Portal with Backstage
Let's build Developer Portal with Backstage
 
Web development django.pdf
Web development django.pdfWeb development django.pdf
Web development django.pdf
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Django by rj
Django by rjDjango by rj
Django by rj
 
Django rest framework
Django rest frameworkDjango rest framework
Django rest framework
 
CollegeDiveIn presentation
CollegeDiveIn presentationCollegeDiveIn presentation
CollegeDiveIn presentation
 
Moodle Development Best Pracitces
Moodle Development Best PracitcesMoodle Development Best Pracitces
Moodle Development Best Pracitces
 
DevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and ProjectsDevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and Projects
 
The New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by PythonThe New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by Python
 
Use open source software to develop ideas at work
Use open source software to develop ideas at workUse open source software to develop ideas at work
Use open source software to develop ideas at work
 
UiPath Community - Dallas - Studio Web.pdf
UiPath Community - Dallas - Studio Web.pdfUiPath Community - Dallas - Studio Web.pdf
UiPath Community - Dallas - Studio Web.pdf
 

More from Chariza Pladin (7)

Day 4 - Advance Python - Ground Gurus
Day 4 - Advance Python - Ground GurusDay 4 - Advance Python - Ground Gurus
Day 4 - Advance Python - Ground Gurus
 
Ground Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - ClassesGround Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - Classes
 
AI - The Good, Bad and scary truth of Super Intelligence
AI - The Good, Bad and scary truth of Super IntelligenceAI - The Good, Bad and scary truth of Super Intelligence
AI - The Good, Bad and scary truth of Super Intelligence
 
Computer vision and Open CV
Computer vision and Open CVComputer vision and Open CV
Computer vision and Open CV
 
Ground Gurus Introduction
Ground Gurus IntroductionGround Gurus Introduction
Ground Gurus Introduction
 
Introduction to Machine learning with Python
Introduction to Machine learning with PythonIntroduction to Machine learning with Python
Introduction to Machine learning with Python
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Recently uploaded (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

Intro to Web Development Using Python and Django