# Python@DSI

Olivier Bieler
ISAS-FSD
08.03.2023
---
## Menu
1. Introduction à Python
2. Framework utilisés (ISAS-FSD)
3. Applications utilisant Python (DSI)
4. Forces et faiblesses de Python
5. (option) Introduction à Django
---
### Python | Historique
* Créé en 1989 par **Guido van Rossum**, publié en 1991
* Son nom provient de la troupe de comiques Monty Python
* Sous license libre, sous propriété de la **Python Software Foundation** (Association qui organise le développement de Python)
---
### Python | Caractéristiques (1/2)
* Language interprété, orienté objet, de haut niveau
* Syntaxe lisible, clair
* Gestion auto. de la mémoire (garbage-collector)
* Gestion des exceptions
---
### Python | Caractéristiques (2/2)
* Extensible: https://pypi.org (Python package Index)
* Compilé en bytecode (.pyc) comme Java, mais généré dynamiquement
* Types de bases: list, dict, str, int, float, etc.
* Syntaxe: délimitation par indentation
---
### Framework utilisé(s) (ISAS-FSD)

---
### Applications utilisant Python (1/3)
#### Python + Django
* Actu -- [actu.epfl.ch](https://actu.epfl.ch) - [Dépôt](https://github.com/epfl-si/epfl-news)
* Memento -- [memento.epfl.ch](https://memento.epfl.ch) - [Dépôt](https://github.com/epfl-si/memento)
* Revue de presse -- [rdp.epfl.ch](https://rdp.epfl.ch) - [Dépôt](https://github.com/epfl-si/press-release)
* Médiathèque -- [mediatheque.epfl.ch](https://mediatheque.epfl.ch) - [Dépôt](https://github.com/epfl-si/site-diffusion-mediatheque)
* OFRF -- [ofrf.epfl.ch](epfl-si/bill2myprint) - [Dépôt](https://github.com/epfl-si/bill2myprint)
---
### Applications utilisant Python (2/3)
#### Packages Python-Django (ISAS-FSD)
* django-epfl-misc -- [Dépôt](https://github.com/epfl-si/django-epfl-misc)
* django-epfl-mail -- [Dépôt](https://github.com/epfl-si/django-epfl-mail)
* django-tequila -- [Dépôt](https://github.com/epfl-si/django-tequila)
---
### Applications utilisant Python (3/3)
#### Python (DSI)
* Infoscience-Exports -- [Dépôt](https://github.com/epfl-si/infoscience-exports)
* Infoscience-Authors -- [Dépôt](https://github.com/epfl-si/infoscience-authors)
* Infoscience-Patents -- [Dépôt](https://github.com/epfl-si/infoscience-patents)
* vRA toolbox -- [Dépôt](https://github.com/epfl-si/xaas-vra8-rest-api)
* Synchro Google Cloud (Archiver) -- [Dépôt](https://c4science.ch/source/google-gcds-archiver)
---
### Forces et faiblesses de Python
#### Forces
* Facile à apprendre et lisible
* Grande communauté
* Large bibliothèque (standard et additionnel)
* Polyvalent (développement Web, analyse de données, script divers...)
* Multiplateforme
---
### Forces et faiblesses de Python
#### Faiblesses
* Lenteur (langage interprété)
* Consommation de mémoire (à cause de son typage dynamique)
* Pas optimal pour le développement mobile
* Couche d'accès aux DB (archaïque)
---
### Introduction à Django

---

---
### Django | Historique
* Développé en 2003 par le journal local de Lawrence (Kansas)
* Publié sous license [BSD (3-Clause)](https://github.com/django/django/blob/main/LICENSE)
* Version stable du jour = 4.1
---
### Django | Architecture
* Inspiré du modèle d'architecture [MVC](https://fr.wikipedia.org/wiki/Mod%C3%A8le-vue-contr%C3%B4leur)
* Modèle d'architecture MVT
* [Modèle](https://docs.djangoproject.com/en/4.1/#the-model-layer) (Manipulation des données)
* [Vue](https://docs.djangoproject.com/en/4.1/#the-view-layer) (Traitement des requêtes et renvoi des réponses)
* [Template](https://docs.djangoproject.com/en/4.1/topics/templates/) (Django fournit son propre système de template (DTL) ainsi que Jinja2)
---
## Django | Modèle d'architecture MVT

---
### Django | Contenu (1/2)
* Création de formulaires + validations des données
* ORM
* Outil d'administration
* Organisation des urls
* Sécurité
* Gestion des caches
---
### Django | Contenu (2/2)
* Gestion des fichiers statiques
* Envoi d'emails
* Logging
* Pagination
* Sessions
* ...
---
### Django | Avantages
* Secure
* Bonnes documentations
* Simple à utiliser
* Modules externes facilement implémentable
* Mises à jour, niveau de support
* Largement utilisé (dont: Pinterest, Instagram)
* Supporte PostgreSQL, MariaDB, MySQL, Oracle et SQLite.
---
### Django | Quelques liens
* [Django Project](https://www.djangoproject.com/)
* [Documentation](https://docs.djangoproject.com/en/4.1/)
* [Tutoriel](https://docs.djangoproject.com/en/4.1/intro/tutorial01/)
* [Dépôt](https://github.com/django/django)
---
### MERCI
{"metaMigratedAt":"2023-06-17T22:48:40.536Z","metaMigratedFrom":"YAML","title":"Python@DSI","breaks":true,"slideOptions":"{\"transition\":\"slide\",\"theme\":\"league\",\"progress\":true,\"slideNumber\":true,\"center\":true}","contributors":"[{\"id\":\"16d009bd-c0a7-46aa-9c59-98446de3eb94\",\"add\":5222,\"del\":352}]"}