0% found this document useful (0 votes)
49 views22 pages

Ayush Django Report

The document discusses Django, an open source Python web framework. It describes how Django works using the MVT pattern with models, views and templates. It covers Django's history, design philosophies, advantages, features like rapid development, security, scalability and being fully loaded.

Uploaded by

armanhaider845
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views22 pages

Ayush Django Report

The document discusses Django, an open source Python web framework. It describes how Django works using the MVT pattern with models, views and templates. It covers Django's history, design philosophies, advantages, features like rapid development, security, scalability and being fully loaded.

Uploaded by

armanhaider845
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

1

Content
1. Introduction
2. How does Django Work?

2.1 Model…………………………………………………………………………….

2.2 View…................................................................................

2.3 Template……………………………………………………………………….

3. Django History

4. Django - Design Philosophies

5. Advantages of Django

6. Django Overview

6.1 MVC Pattern…………………………………………………………………..

6.2 Django MVC – MVT Pattern ……………………………………………

7. Features of Django

7.1 Rapid Development…………………………………………………………

7.2 Secure……………………………………………………………………………

7.3 Scalable…………………………………………………………………………..

7.4 Fully Loaded…………………….................................................

7.5 Varsatile………………………………………………………………………….

7.6 Open Source……………………………………………………………………


2

8. Object Oriented Programming (OOPs)

8.1 Features of OOPs………………………………………………………….........

8.2 Python Class…………………………………………………………………………

8.3 Python Objects…………………………………………………………………….

8.4 Python Inheritance……………………………………………………………….

8.4.1 Types of Inheritance………………………………………………..…………

8.5 Python Polymorphism………………………………………………………..

8.6 Python Encapsulation………………………………………………………

8.7 Data Abstraction……………………………………………………………..

9. Object and Class in Python

9.1 Object of Python Class……………………………………………………….

10. Data Types

11. Python Operators

11.1 Types of Operators in Python

12. Colclusiom
3

1. Introduction
Django is a Python framework that makes it easier to create web sites
using Python

Django is a web application framework written in Python programming


language. It is based on MVT (Model View Template) design pattern.
The Django is very demanding due to its rapid development feature. It
takes less time to build application after collecting client requirement.

Django takes care of the difficult stuff so that you can concentrate on
building your web applications.

Django emphasizes reusability of components, also referred to as DRY


(Don't Repeat Yourself), and comes with ready-to-use features
like login system, database connection and CRUD operations (Create
Read Update Delete).

Django is a Python-based web application framework that is free and


open source. A framework is simply a collection of modules that
facilitate development. They're grouped together and allow you to
build apps or websites from scratch rather than starting from scratch

2.How does Django Work?


Django follows the MVT design pattern (Model View Template).

 Model - The data you want to present, usually data from a database.
 View - A request handler that returns the relevant template and
content - based on the request from the user.
4

 Template - A text file (like an HTML file) containing the layout of the
web page, with logic on how to display the data.

2.1 Model
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

2.2 View
A view is a function or method that takes http requests as arguments,
imports the relevant model(s), and finds out what data to send to the
template, and returns the final result.

The views are usually located in a file called views.py.


5

2.3 Template
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.

Model View

Template
6

3. Django History
Django was invented by Lawrence Journal-World in 2003, to meet the short deadlines in the newspaper
and at the same time meeting the demands of experienced web developers.

Initial release to the public was in July 2005.

Latest version of Django is 4.0.3 (March 2022).

 2003 − Started by Adrian Holovaty and Simon Willison as an


internal project at the Lawrence Journal-World newspaper.
 2005 − Released July 2005 and named it Django, after the jazz
guitarist Django Reinhardt.
 2005 − Mature enough to handle several high-traffic sites.
 Current − Django is now an open source project with contributors
across the world
7

4. Django – Design Philosophies


Django comes with the following design philosophies –

 Loosely Coupled − Django aims to make each element of its stack


independent of the others.
 Less Coding − Less code so in turn a quick development.
 Don't Repeat Yourself (DRY) − Everything should be developed
only in exactly one place instead of repeating it again and again.
 Fast Development − Django's philosophy is to do all it can to
facilitate hyper-fast development.
 Clean Design − Django strictly maintains a clean design
throughout its own code and makes it easy to follow best web-
development practices.
8

5. Advantages of Django

Here are few advantages of using Django which can be listed out here −

 Object-Relational Mapping (ORM) Support − Django provides a


bridge between the data model and the database engine, and
supports a large set of database systems including MySQL, Oracle,
Postgres, etc. Django also supports NoSQL database through
Django-nonrel fork. For now, the only NoSQL databases supported
are MongoDB and google app engine.
 Multilingual Support − Django supports multilingual websites
through its built-in internationalization system. So you can
develop your website, which would support multiple languages.
 Framework Support − Django has built-in support for Ajax, RSS,
Caching and various other frameworks.
 Administration GUI − Django provides a nice ready-to-use user
interface for administrative activities.
 Development Environment − Django comes with a lightweight
web server to facilitate end-to-end application development and
testing.
9

6. Django Overview
As you already know, Django is a Python web framework. And like most
modern framework, Django supports the MVC pattern. First let's see
what is the Model-View-Controller (MVC) pattern, and then we will look
at Django’s specificity for the Model-View-Template (MVT) pattern.

6.1 MVC Pattern

When talking about applications that provides UI (web or desktop), we


usually talk about MVC architecture. And as the name suggests, MVC
pattern is based on three components: Model, View, and Controller.
Check our MVC tutorial here to know more.

6.2 DJANGO MVC - MVT Pattern

The Model-View-Template (MVT) is slightly different from MVC. In fact


the main difference between the two patterns is that Django itself takes
care of the Controller part (Software Code that controls the interactions
between the Model and View), leaving us with the template. The
template is a HTML file mixed with Django Template Language (DTL).

7. Features of Django
o Rapid Development
10

o Secure
o Scalable
o Fully loaded
o Versatile
o Open Source
o Vast and Supported Community

7.1 Rapid Development


Django was designed with the intention to make a framework
which takes less time to build web application. The project
implementation phase is a very time taken but Django creates it
rapidly.

7.2 Secure
Django takes security seriously and helps developers to avoid
many common security mistakes, such as SQL injection, cross-site
scripting, cross-site request forgery etc. Its user authentication
system provides a secure way to manage user accounts and
passwords.

7.3 Scalable
Django is scalable in nature and has ability to quickly and flexibly
switch from small to large scale application project.
11

7.4 Fully loaded


Django includes various helping task modules and libraries which
can be used to handle common Web development tasks. Django
takes care of user authentication, content administration, site
maps, RSS feeds etc.

7.5 Versatile
Django is versatile in nature which allows it to build applications
for different-different domains. Now a days, Companies are using
Django to build various types of applications like: content
management systems, social networks sites or scientific
computing platforms etc.

7.6 Open Source


Django is an open source web application framework. It is publicly
available without cost. It can be downloaded with source code
from the public repository. Open source reduces the total cost of
the application development.

8. Object Oriented Programming (OOPs)


12

In Python, object-oriented Programming (OOPs) is a


programming paradigm that uses objects and classes in
programming. It aims to implement real-world entities like
inheritance, polymorphisms, encapsulation, etc. in the
programming. The main concept of OOPs is to bind the data and
the functions that work on that together as a single unit so that
no other part of the code can access this data .
An object-oriented paradigm is to design the program using
classes and objects. The object is related to real-word entities
such as book, house, pencil, etc. The oops concept focuses on
writing the reusable code. It is a widespread technique to solve
the problem by creating objects.

Object Oriented Programming is a way of computer programming


using the idea of object to represents data and methods. It is also,
an approach used for creating neat and reusable code instead of
a redundant one. the program is divided into self-contained
objects or several mini-programs. Every Individual object
represents a different part of the application having its own logic
and data to communicate within themselves.
13

8.1 Features of OOPs


 Class
 Objects
 Polymorphism
 Encapsulation
 Inheritance
 Data Abstraction
14

8.2 Python Class


A class is a collection of objects. A class contains the blueprints
or the prototype from which the objects are being created. It is a
logical entity that contains some attributes and methods.
To understand the need for creating a class let’s consider an
example, let’s say you wanted to track the number of dogs that
may have different attributes like breed, and age. If a list is used,
the first element could be the dog’s breed while the second
element could represent its age. Let’s suppose there are 100
different dogs, then how would you know which element is
supposed to be which? What if you wanted to add other
properties to these dogs? This lacks organization and it’s the
exact need for classes.

8.2.1 Class definition Syntax

class ClassName:
# Statement-1
.
.
.
# Statement-N
15

8.3 Python Objects


The object is an entity that has a state and behavior associated
with it. It may be any real-world object like a mouse, keyboard,
chair, table, pen, etc. Integers, strings, floating-point numbers,
even arrays, and dictionaries, are all objects. More specifically,
any single integer or any single string is an object. The number
12 is an object, the string “Hello, world” is an object, a list is an
object that can hold other objects, and so on. You’ve been using
objects all along and may not even realize it.
An object consists of:
 State: It is represented by the attributes of an object. It also
reflects the properties of an object.
 Behavior: It is represented by the methods of an object. It also
reflects the response of an object to other objects.
 Identity: It gives a unique name to an object and enables one
object to interact with other objects.

8.4 Python Inheritance


Inheritance is the capability of one class to derive or inherit the
properties from another class. The class that derives properties
is called the derived class or child class and the class from which
the properties are being derived is called the base class or
parent class. The benefits of inheritance are :
 It represents real-world relationships well.
 It provides the reusability of a code. We don’t have to write the
same code again and again. Also, it allows us to add more
features to a class without modifying it.
 It is transitive in nature, which means that if class B inherits
from another class A, then all the subclasses of B would
automatically inherit from class A.
16

8.4.1 Types of Inheritance


 Single Inheritance: Single-level inheritance enables a derived
class to inherit characteristics from a single-parent class.
 Multilevel Inheritance: Multi-level inheritance enables a
derived class to inherit properties from an immediate parent
class which in turn inherits properties from his parent class.
 Hierarchical Inheritance: Hierarchical-level inheritance
enables more than one derived class to inherit properties from
a parent class.
 Multiple Inheritance: Multiple-level inheritance enables one
derived class to inherit properties from more than one base
class.

8.5 Python Polymorphism


Polymorphism simply means having many forms. For example,
we need to determine if the given species of birds fly or not,
using polymorphism we can do this using a single function.

Polymorphism in Python
This code demonstrates the concept of inheritance and method
overriding in Python classes. It shows how subclasses can
override methods defined in their parent class to provide specific
behavior while still inheriting other methods from the parent
class.
17

8.6 Python Encapsulation


Encapsulation is one of the fundamental concepts in
object-oriented programming (OOP). It describes the idea
of wrapping data and the methods that work on data
within one unit. This puts restrictions on accessing
variables and methods directly and can prevent the
accidental modification of data. To prevent accidental
change, an object’s variable can only be changed by an
object’s method. Those types of variables are known as
private variables.
A class is an example of encapsulation as it encapsulates
all the data that is member functions, variables, etc.
18

8.7 Data Abstraction


It hides unnecessary code details from the user. Also,
when we do not want to give out sensitive parts of our
code implementation and this is where data abstraction
came.
Data Abstraction in Python can be achieved by creating
abstract classes.

9. Object and Class in Python


A class is a user-defined blueprint or prototype from which
objects are created. Classes provide a means of bundling data
and functionality together. Creating a new class creates a new
type of object, allowing new instances of that type to be made.
Each class instance can have attributes attached to it for
maintaining its state. Class instances can also have methods
(defined by their class) for modifying their state.
To understand the need for creating a class and object
in Python let’s consider an example, let’s say you wanted to
track the number of dogs that may have different attributes like
breed and age. If a list is used, the first element could be the
dog’s breed while the second element could represent its age.
Let’s suppose there are 100 different dogs, then how would you
know which element is supposed to be which? What if you
wanted to add other properties to these dogs? This lacks
organization and it’s the exact need for classes.
19

9.1 Object of Python Class


An Object is an instance of a Class. A class is like a blueprint
while an instance is a copy of the class with actual values. It’s
not an idea anymore, it’s an actual dog, like a dog of breed pug
who’s seven years old. You can have many dogs to create many
different instances, but without the class as a guide, you would
be lost, not knowing what information is required.
An object consists of:
 State: It is represented by the attributes of an object. It also
reflects the properties of an object.
 Behavior: It is represented by the methods of an object. It also
reflects the response of an object to other objects.
 Identity: It gives a unique name to an object and enables one
object to interact with other objects.

10. Data Types


Data types are the classification or categorization of data items.
It represents the kind of value that tells what operations can be
performed on a particular data. Since everything is an object
in python programming, data types are actually classes and
variables are instances (object) of these classes. The following
are the standard or built-in data types in Python:
20

11. Python Operators


Operators in general are used to perform operations on values
and variables. These are standard symbols used for the purpose
of logical and arithmetic operations. In this article, we will look
into different types of Python operators.
 OPERATORS: These are the special symbols. Eg- + , * , /, etc.
 OPERAND: It is the value on which the operator is applied.
21

11.1 Types of Operators in Python


22

12. Conclusion
The Django framework gives us a simple and reliable way to create the
course management system. It provides powerful functionalities and
concise syntax to help programmers deal with the database, the web
page and the inner logic. The experience of developing the group
component in the system also helped me learning a lot of website
development with Django. Within the Django framework, we have
successfully accomplished the requirements of the system. Once this
system passes the testing phase, it can be used to serve students and
instructors and substitute several systems currently in service. It will
make the work for instructors to manage the course much easier. It
also can simplify the operations for students with grade book,
submission, and group management all in one system. In short, this
system will bring great user experience to both instructors and
students. The only limitation for this course system is that although the
developers have been testing it with various use cases, it may still
encounter problems during real time use. However, even if that
happens, the flexibility of Django would provide a simple way to fix the
problem, as well as add new features into the system.

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