← Retour

Python with Django and MySQL

par: Boubaker Kahloula
Disponible
Pages 374
Dimensions 16*23,5
Publication 2026-10-19
Éditeur —
Papier : 1 900.00 DA Numérique: 950.00 DA

The Python programming language was developed in the early 1990s by the Dutchman Guido van Rossum at the Centrum voor Wiskunde en Informatica (CWI) in Amsterdam. The name Python is not inspired by the family of snakes, but by the British comedy troupe Monty Python. It is a programming language that is both powerful and easy to learn, and according to some statistics it is on its way to overtaking Java in terms of popularity and traffic. Python is a multiparadigm programming language. It is possible, for example, to program in Python in an object-oriented as well as a functional style. Python programs are independent of the platform on which they are run, in particular Windows, Linux or macOS. The Python standard library is very extensive; it offers a wide range of tools, from the most basic, for example for text manipulation, file access and mathematical operations, to the most sophisticated, for example for network communication or data storage. A good number of fast-growing companies use, at least in part, Python for the development of their programs or Web applications (Gmail, Google Maps, YouTube, Dropbox, etc.). We can therefore say that Python is a popular, widely used and modern programming language that is certainly worth learning. This book is a translation of a previously published French edition, with certain corrections made to the French version. The translation was done largely with the help of Claude, Anthropic's artificial intelligence assistant. The aim of this book is to introduce Python to developers and students who are already familiar with other programming languages, and to provide professionals with a reference they can turn to whenever the need arises. In the first chapter, we begin by stating the advantages of the Python programming language and listing the main development environments for Python. We have devoted the second chapter to a description of the installation of Python. In the third chapter we develop our first application, a Python script that displays the message Hello World! The elements common to all programming languages (data and operators, control structures) are covered in the fourth and fifth chapters. The aspect of object-oriented programming (OOP) in Python is covered in the sixth chapter. It is in this chapter that we present the notions of class, method, constructor and destructor, instantiation, inheritance, etc. The processing of files and directories, for its part, is described in the seventh chapter. The advanced concepts, intended for readers who will already be thoroughly familiar with the basic concepts, are the subject of the eighth chapter: numerous examples will make it possible to grasp clearly the notions of iterators, generators, closures, decorators, etc. Access from Python to data stored in a database is the subject of the ninth chapter. The choice of the Database Management System (DBMS) MySQL to address this aspect is not fortuitous, since MySQL is one of the most widespread DBMSs in the world. It is a piece of software, available in both an open source and a commercial version, which can run on many operating systems. Python of course has a library that makes it possible, by converting data types, to integrate the two: Python and MySQL. In this ninth chapter we describe the installation of the MySQL DBMS as well as its administration and development tools. We have also described in this chapter the compilation of the free software XAMPP, which contains the MySQL DBMS and makes it possible to install and configure it quickly. In this chapter we study access to a MySQL database from a Python script and the insertion, in a Python script, of SQL commands (Structured Query Language) with their various clauses, whether the commands relate to a data definition or to a data manipulation. The eleventh chapter is entirely devoted to the Django web development environment. Django is to Python what Symfony is to PHP. Its ability to implement projects quickly and efficiently means that it is considered “intended for perfectionists who want to manage their time optimally”. With Django, structured according to the Model-Template-View (MTV) pattern, itself based on the well- known Model-View-Controller (MVC) pattern, the developer adheres to the DRY principle (don’t repeat yourself - avoid repetition). Django appears today as an optimal solution for an MVP design (Minimum Viable Product - the smallest viable product). Many start-ups today choose the MVP model to develop an initial piece of software, and the MVP design can be implemented, with the Django framework, in an optimal way. It is available there and ready to use. The architecture of a Django application is described in this eleventh chapter, as well as the administration application contained in Django. An example of developing a web application, step by step, is given in this chapter. The reserved words as well as the naming conventions, useful for easy maintenance of programs or for their extensions, are given at the end of the book. After that will be found a description of the most commonly used HTML tags, solved exercises, as well as the answers to the multiple-choice questions offered at the end of each chapter. To make this book easy to read, different fonts have been used to distinguish its text from the Python code given in the examples and exercises.

Afficher la table des matières
Table of contents
Introduction
Chapter 1: The Python language
1.1. What is Python?
1.2. Advantages of the Python programming language
1.3. Development environments for Python
Questions with answers
Chapter 2: Installation
Installation
Questions / Answers
Chapter 3: First application
3.1. First Application
3.2. Basic syntax
Questions with answers
Chapter 4: Data and operators
4.1. Variables
4.2. Constants
4.3. Literals
4.4. Standard data types
4.5. Conversions between types
4.6. Operators
Questions with answers
Chapter 5: Program structure
5.1. Control structures
5.2. Modules and packages
5.3. Functions
5.4. Namespaces and Scope
5.5. Syntax errors and exceptions
Questions with answers
Chapter 6: Object-oriented programming
6.1. Object-oriented programming
6.2. Classes
6.3. Methods
6.4. Keyword self
6.5. Constructor
6.6. Instantiation
6.7. Inheritance
6.8. Overloading and overriding
6.9. Destructors
6.10. Instance, class, or static method
Questions with answers
Chapter 7: Processing files and directories
7.1. File processing
7.2. Directory processing
Questions with answers
Chapter 8: Advanced concepts
8.1. Iterators
8.2. Generators
8.3. Closure
8.4. Decorators
8.5. Properties
8.6. Regular expressions
Questions with answers
Chapter 9: Python & MySQL
9.1. What is MySQL?
9.2. The SQL language
9.3. Installing the MySQL DBMS
9.4. Administration and development tools
9.5. Installing the MySQL driver for Python
9.6. Operations on databases
Questions with answers
Chapter 10: Graphical interface
10.1. What is a Graphical User Interface?
10.2. Widgets
10.3. Event handling
Questions with answers
Chapter 11: Python & Django
11.1. What is Django?
11.2. Architecture of an application
11.3. Application example
11.4. The administration application
Questions with answers
Keywords
Naming conventions
Most common HTML tags
Exercises with solutions
Answers to the questions
Bibliography

Avis des lecteurs

Aucun avis pour le moment.