2. What is Python?
· Python is a high-level, interpreted programming language that is widely used for web development, scientific computing, data
analysis, artificial intelligence, and other applications. It is known for its readability and simplicity, making it a great language
for beginners to learn.
3. Some of its key features include:
· Dynamic semantics
· Automatic memory management
· High-level built-in data structures
· Support for multiple programming paradigms, including object-oriented, imperative, and functional programming
· A large and active user community
· A vast selection of libraries and frameworks Available on various operating systems
· Open-source
Python 3 is the latest version of Python, with a number of improvements and new features over Python 2.
4. Python Features
· Simple and easy to learn: Python has a simple and easy-to-understand syntax, making it an excellent language for beginners.
· Interpreted language: Python is an interpreted language, meaning the source code can is compiled and executed line by line, making it easier to debug
and test.
· High-level language: Python is a high-level language that abstracts away many low-level programming details.
· Object-oriented programming: Python supports object-oriented programming, a programming paradigm that organises code into objects and classes,
making it easier to reuse and maintain.
· Extensive standard library: Python has a large library, which includes modules for various everyday programming tasks, such as connecting to web
servers, reading and writing files, and working with data.
· Dynamic semantics: Python has dynamic semantics, meaning that the variable type is determined at runtime, not compile time.
· Automatic memory management: Python automatically manages memory, so developers do not worry about memory leaks or other memory-related
issues.
· Support for multiple programming paradigms: Python supports multiple programming paradigms, including object-oriented, imperative, and functional
programming.
· Active community: Python has an active community of developers who contribute to the language and its ecosystem, providing support and creating new
libraries and frameworks.
· Platform-independent: Python is platform-independent, it can run on various operating systems such as Windows, Mac, and Linux. Open-source: Python
is open-source, it means that the source code is freely available and can be modified and distributed by anyone.
5. What is Django?
· Django is a high-level Python web framework that enables rapid development of secure and maintainable websites.
· It follows the Model-View-Controller (MVC) architectural pattern and emphasises reusability and "pluggability" of components.
6. Some of its key features include:
· Object-relational mapper (ORM): Django includes an ORM that allows developers to interact with databases using Python code, rather than writing
raw SQL queries.
· Automatic admin interface: Django provides an automatic admin interface that allows developers to manage the content of their website without
writing any additional code.
· Template engine: Django includes a template engine that separates the presentation logic of a website from its business logic, making it easier to
maintain and update the website's design. URL routing: Django allows you to define URL patterns for your views, so you can easily map URLs to
views. Security features: Django includes built-in security features such as cross-site scripting (XSS) protection, cross-site request forgery (CSRF)
protection, and SQL injection protection.
· Scalability: Django is designed to handle high traffic and is used by many large websites, such as Instagram, Pinterest, and The Washington Times.
Middleware: Django provides a flexible middleware system that allows developers to add functionality to the request/response processing flow,
such as authentication, caching, and compression.
· Community: Django has a large and active community that contributes to the framework, providing support, creating plugins, and developing new
features. Mature: Django is a mature framework, it has been around since 2005, which means it has had plenty of time to mature and stabilize.
· Mature: Django is a mature framework, it has been around since 2005, which means it has had plenty of time to mature and stabilize.
7. Django follows the Model-View-Controller (MVC) architectural pattern, which separates the application logic
into three components: the model, the view, and the controller.
The workflow in Django can be summarised as follows:
· Models: The models are used to define the data structure and relationships of the application. They are written in Python and use the Object-Relational
Mapping (ORM) system to interact with the database.
· Views: The views handle the business logic of the application. They handle user requests and determine what data to retrieve from the models and how
to present it to the user.
· Templates: The templates are used to define the presentation of the data. They use a template language to define the structure of the HTML pages and
are populated with data from the views.
· Controllers: The controllers are responsible for handling user requests and determining which view should be used to handle the request. They use URL
routing to map URLs to views.
· URL Routing: URL routing maps URLs to views. It is used to determine which view should handle a specific request based on the URL requested.
· Forms: Django provides built-in forms classes to handle forms. It allows you to define forms in python classes and render them in the templates.
Administration:
· Django also provides an automatically generated admin interface that makes it easy to manage data.
· Testing: Django includes a testing framework that allows you to write unit tests for your models and views to ensure that your code is working as
expected.