création d’un serveur
le serveur habituel est apache2 , il est placé en /var/www/ ou /var/www/html et accessible via ce lien
le serveur python est intéressant aussi
$ cd /var/www/html/machin && python3 -m http.server 8000 # for Python 3
$ cd /var/www/html/machin && python2 -m SimpleHTTPServer 8000 # for Python 2
il est placé en /var/www/html/machin et accessible via ce lien
Accueil > Mots-clés > _multirubricage > python
python
Articles
-
comparaisons_languages_PythonPhpCJavascriptLibreoffice
20 mai 2017, par bruno -
serveur internet
2 août 2016, par bruno -
multi langages
5 juin 2017, par brunopython en php $mavar = array() ; exec("python b.py", $mavar) ; var_dump($mavar) ; sh/bash en python import os os.system(’commande’) python en sh/bash
python machin.py php en bash
# !/usr/bin/env php < ?php phpinfo() ; ?> -
frameworks
27 mai 2017, par brunoPage générale des webframeworks : https://wiki.python.org/moin/WebFrameworks/ django The Web framework for perfectionists (with deadlines). Django makes it easier to build better Web apps more quickly and with less code. Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. It lets you build high-performing, elegant Web applications quickly. Django focuses on automating as much as possible and adhering to the DRY (Don’t Repeat Yourself) (…)
-
hotspot + lamp
3 juin 2021, par brunosur le serveur :
– qpython 3s
– programme serveur-python3.py import http.server import socketserver
PORT = 8000 import sys Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd : print("utilisation du port ",PORT,", argv = ",sys.argv) httpd.serve_forever()
– le dossier qpython est la base du serveur, on peut rajouter le dossier html
et un fichier index.html dans le dossier qpython qui envoie (…) -
flask
14 novembre 2022, par brunoinstallation espace virtuel premier programme documentations
Installation
# sudo apt-get install python3-pip python3-venv
Création d’un espace virtuel
mkdir -p microblog && cd microblog python3 -m venv venv virtualenv venv source venv/bin/activate
premier programme
(venv) $ pip install flask gunicorn (venv) $ mkdir -p app app/__init__.py from flask import Flask app = Flask(__name__) from app import routes
app/routes.py from app import app @app.route(’/’) (…) -
python en virtuel
11 juillet 2023, par brunoPour permettre l’utilisatio nde python dans toutes les situations, il a été décidé de metrte en avant la virtualisation :
https://peps.python.org/pep-0668/
et donc on utilise comme ça : python3 -m venv /tmp/venv ; source /tmp/venv/bin/activate ; pip install —upgrade pip ; pip3 install matplotlib numpy opencv-python opencv-contrib-python tensorflow
erreurs : Could not build wheels for dlib, erreur apparue pour installer face-recognition , d’après (…) -
utilisation de python3-plotly - Python 3...
8 mai 2020, par brunoIl s’agit d’une classe python qui permet de créer des pages de visualisation de type html+css+js
-
module re : match et find divers
26 octobre 2017, par brunoimport re
Etude de
<tr class='row_odd odd'><td>anciennes commandes net-tools</td><td>commandes iproute2 de remplacement</td></tr> <tr class='row_even even'><td>arp</td><td>ip n (ip neighbor)</td></tr> <tr class='row_odd odd'><td>ifconfig</td><td>ip a (ip addr), ip link, ip -s (ip -stats)</td></tr> <tr class='row_even (…) -
module : subprocess
30 janvier 2018, par brunoce module remplace os.system , os.spawn* , os.popen* , popen2.* , commands.*