django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
The model provides data from the database.
In Django, the data is delivered as an Object Relational Mapping
(ORM), which is a technique designed to make it easier to work with
databases.
The most common way to extract data from a database is SQL. One
problem with SQL is that you have to have a pretty good
understanding of the database structure to be able to work with it.
Django, with ORM, makes it easier to communicate with the database,
without having to write complex SQL statements.
The models are usually located in a file called models.py.
django part-1
A template is a file where you describe how the result
should be represented.
Templates are often .html files, with HTML code describing
the layout of a web page, but it can also be in other file
formats to present other results, but we will concentrate on
.html files.
Django uses standard HTML to
describe the layout, but uses
Django tags to add logic:
<h1>My Homepage</h1>
<p>My name is {{ firstname
}}.</p>
The templates of an application is located in a folder
named templates.
Django also provides a way to
navigate around the different pages
in a website.
When a user requests a URL, Django
decides which view it will send it to.
This is done in a file called urls.py.
1 - Django receives the URL,
checks the urls.py file, and calls
the view that matches the URL.
2 - The view, located in views.py,
checks for relevant models.
3 - The models are imported
from the models.py file.
4 - The view then sends the data
to a specified template in
the template folder.
5 - The template contains HTML
and Django tags, and with the
data it returns finished HTML
content back to the browser.
django part-1
django part-1
django part-1
django part-1
django part-1
Note: You must activate the
virtual environment every time
you open the command prompt to
work on your project.
Note: Now you have installed Django in your new project,
running in a virtual environment!
django part-1
django part-1
Navigate to where in the file system you
want to store the code (in the virtual
environment), and run this command in
the command prompt:
django-admin startproject myworld
Django creates a myworld folder on my
computer, with this content:
myworld
manage.py
myworld/
__init__.py
asgi.py
settings.py
urls.py
wsgi.py
Now that you have a Django
project, you can run it, and see
what it looks like in a browser.
Navigate to the /myworld folder
and execute this command in
the command prompt:
py manage.py runserver
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
Django views are Python functions
that takes http requests and returns
http response, like HTML documents.
A web page that uses Django is full of
views with different tasks and
missions.
Views are usually put in a file
called views.py located on your app's
folder.
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
When we created the Django project, we got an empty SQLite
database. It was created in the myworld root folder.
We will use this database in this session.
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
To add some HTML around the
values, we will create a template
for the application.
All templates must be located in
the templates folder off your app,
if you have not already created
a templates folder, do it now.
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1
django part-1

More Related Content

PDF
Technical SEO
PDF
Introduction to HTML
PDF
How To Adapt To Google's Helpful Content & Core Updates.pdf
PDF
web development
PPT
Jena
PPTX
Django - Python MVC Framework
PPTX
CSS corso base (classi seconde, mod 1)
PPT
Django, What is it, Why is it cool?
Technical SEO
Introduction to HTML
How To Adapt To Google's Helpful Content & Core Updates.pdf
web development
Jena
Django - Python MVC Framework
CSS corso base (classi seconde, mod 1)
Django, What is it, Why is it cool?

What's hot (20)

PDF
Django Tutorial | Django Web Development With Python | Django Training and Ce...
PPTX
ashish ppt webd.pptx
PPTX
URL Presentation
ODP
Django for Beginners
PPTX
Introduction to Viva Topics #CCAS2022
PDF
Intro to beautiful soup
PPTX
Measurefest 2021 - Data visualisation for SEO professionals
PPTX
PDF
Google Tag Manager
PDF
Django class based views for beginners
PDF
[2018 데이터야놀자] 웹크롤링 좀 더 잘하기
PDF
ChatGPT für Juristen 5 unschlagbare Prompts für Rechtsanwälte
PPT
SEO-off page optimization technique
PDF
Le Wagon - 2h Landing
PPTX
Creating a webpage in html
PPTX
Dynamic HTML (DHTML)
PDF
Intro to HTML and CSS basics
PPTX
Top 10 New SharePoint Online Features
PDF
[메조미디어] Media&Market Report_2023.05
PPSX
Introduction to Java
Django Tutorial | Django Web Development With Python | Django Training and Ce...
ashish ppt webd.pptx
URL Presentation
Django for Beginners
Introduction to Viva Topics #CCAS2022
Intro to beautiful soup
Measurefest 2021 - Data visualisation for SEO professionals
Google Tag Manager
Django class based views for beginners
[2018 데이터야놀자] 웹크롤링 좀 더 잘하기
ChatGPT für Juristen 5 unschlagbare Prompts für Rechtsanwälte
SEO-off page optimization technique
Le Wagon - 2h Landing
Creating a webpage in html
Dynamic HTML (DHTML)
Intro to HTML and CSS basics
Top 10 New SharePoint Online Features
[메조미디어] Media&Market Report_2023.05
Introduction to Java
Ad

Similar to django part-1 (20)

PDF
Web development django.pdf
PPTX
Introduction to Django
PDF
Django in Action (MEAP V01) Christopher Trudeau
PPTX
Web development with django - Basics Presentation
PDF
Django Workflow and Architecture
PPTX
Basic Python Django
PDF
Django Documentation
PDF
Rapid web application development using django - Part (1)
DOCX
Akash rajguru project report sem v
PDF
Step-by-Step Django Web Development with Python
PPTX
Django Girls Tutorial
PDF
Django Introduction & Tutorial
PDF
Introduction to Django Course For Newbie - Advance
PDF
Django
PDF
Learn Django Tips, Tricks & Techniques for Developers
PDF
Introduction to django framework
PDF
PDF
Introduction to django
PDF
0506-django-web-framework-for-python.pdf
Web development django.pdf
Introduction to Django
Django in Action (MEAP V01) Christopher Trudeau
Web development with django - Basics Presentation
Django Workflow and Architecture
Basic Python Django
Django Documentation
Rapid web application development using django - Part (1)
Akash rajguru project report sem v
Step-by-Step Django Web Development with Python
Django Girls Tutorial
Django Introduction & Tutorial
Introduction to Django Course For Newbie - Advance
Django
Learn Django Tips, Tricks & Techniques for Developers
Introduction to django framework
Introduction to django
0506-django-web-framework-for-python.pdf
Ad

Recently uploaded (20)

PDF
Mucosal Drug Delivery system_NDDS_BPHARMACY__SEM VII_PCI.pdf
PDF
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI .pdf
PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
PDF
My India Quiz Book_20210205121199924.pdf
PDF
Journal of Dental Science - UDMY (2021).pdf
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
advance database management system book.pdf
PDF
International_Financial_Reporting_Standa.pdf
PDF
HVAC Specification 2024 according to central public works department
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
PPTX
Education and Perspectives of Education.pptx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PDF
English Textual Question & Ans (12th Class).pdf
PPTX
Virtual and Augmented Reality in Current Scenario
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
Mucosal Drug Delivery system_NDDS_BPHARMACY__SEM VII_PCI.pdf
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI .pdf
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
My India Quiz Book_20210205121199924.pdf
Journal of Dental Science - UDMY (2021).pdf
Introduction to pro and eukaryotes and differences.pptx
FORM 1 BIOLOGY MIND MAPS and their schemes
advance database management system book.pdf
International_Financial_Reporting_Standa.pdf
HVAC Specification 2024 according to central public works department
Core Concepts of Personalized Learning and Virtual Learning Environments
Education and Perspectives of Education.pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
English Textual Question & Ans (12th Class).pdf
Virtual and Augmented Reality in Current Scenario
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
AI-driven educational solutions for real-life interventions in the Philippine...
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
Uderstanding digital marketing and marketing stratergie for engaging the digi...

django part-1

  • 7. The model provides data from the database. In Django, the data is delivered as an Object Relational Mapping (ORM), which is a technique designed to make it easier to work with databases. The most common way to extract data from a database is SQL. One problem with SQL is that you have to have a pretty good understanding of the database structure to be able to work with it. Django, with ORM, makes it easier to communicate with the database, without having to write complex SQL statements. The models are usually located in a file called models.py.
  • 9. A template is a file where you describe how the result should be represented. Templates are often .html files, with HTML code describing the layout of a web page, but it can also be in other file formats to present other results, but we will concentrate on .html files. Django uses standard HTML to describe the layout, but uses Django tags to add logic: <h1>My Homepage</h1> <p>My name is {{ firstname }}.</p> The templates of an application is located in a folder named templates.
  • 10. Django also provides a way to navigate around the different pages in a website. When a user requests a URL, Django decides which view it will send it to. This is done in a file called urls.py.
  • 11. 1 - Django receives the URL, checks the urls.py file, and calls the view that matches the URL. 2 - The view, located in views.py, checks for relevant models. 3 - The models are imported from the models.py file. 4 - The view then sends the data to a specified template in the template folder. 5 - The template contains HTML and Django tags, and with the data it returns finished HTML content back to the browser.
  • 17. Note: You must activate the virtual environment every time you open the command prompt to work on your project.
  • 18. Note: Now you have installed Django in your new project, running in a virtual environment!
  • 21. Navigate to where in the file system you want to store the code (in the virtual environment), and run this command in the command prompt: django-admin startproject myworld
  • 22. Django creates a myworld folder on my computer, with this content: myworld manage.py myworld/ __init__.py asgi.py settings.py urls.py wsgi.py
  • 23. Now that you have a Django project, you can run it, and see what it looks like in a browser. Navigate to the /myworld folder and execute this command in the command prompt: py manage.py runserver
  • 30. Django views are Python functions that takes http requests and returns http response, like HTML documents. A web page that uses Django is full of views with different tasks and missions. Views are usually put in a file called views.py located on your app's folder.
  • 42. When we created the Django project, we got an empty SQLite database. It was created in the myworld root folder. We will use this database in this session.
  • 55. To add some HTML around the values, we will create a template for the application. All templates must be located in the templates folder off your app, if you have not already created a templates folder, do it now.