Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| python:install [11-09-2019 14:37] – créée edmc73 | python:install [13-10-2020 12:18] (Version actuelle) – [Installation mod_wsgi] edmc73 | ||
|---|---|---|---|
| Ligne 39: | Ligne 39: | ||
| pip install nom_du_module --upgrade # met à jour le module | pip install nom_du_module --upgrade # met à jour le module | ||
| - | Dasn le fichier requirements.txt, | + | Dans le fichier requirements.txt, |
| + | |||
| + | ===== Installation mod_wsgi ===== | ||
| + | |||
| + | voir cette doc https:// | ||
| + | |||
| + | Mais je n'y suis pas arrivé. | ||
| + | |||
| + | Finalement j'ai opté pour bjoern | ||
| + | (venv3.6) xxx: pip install bjoern | ||
| + | |||
| + | Avec un petit script pour le lancer pour django par exemple | ||
| + | $ cat run_server_bjoern.py | ||
| + | <code python> | ||
| + | import os, sys | ||
| + | from django.core.wsgi import get_wsgi_application | ||
| + | import bjoern | ||
| + | |||
| + | os.environ.setdefault(" | ||
| + | sys.path.append('/ | ||
| + | application = get_wsgi_application() | ||
| + | |||
| + | bjoern.run(application,' | ||
| + | </ | ||
| + | |||
| + | Config Apache en mod reverse proxy | ||
| + | < | ||
| + | < | ||
| + | Define HOSTNAME monapp.com | ||
| + | |||
| + | ServerName ${HOSTNAME} | ||
| + | DocumentRoot / | ||
| + | |||
| + | < | ||
| + | Require all granted | ||
| + | </ | ||
| + | |||
| + | ProxyPass / http:// | ||
| + | ProxyPassReverse / http:// | ||
| + | |||
| + | |||
| + | ErrorLog / | ||
| + | |||
| + | LogLevel warn | ||
| + | |||
| + | CustomLog / | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Pour garder le process actif lorsqu' | ||
| + | apt install supervisor | ||
| + | |||
| + | Avec la conf | ||
| + | # cat / | ||
| + | < | ||
| + | [program: | ||
| + | process_name=%(program_name)s_%(process_num)02d | ||
| + | command=/ | ||
| + | autostart=true | ||
| + | autorestart=true | ||
| + | user=monuser | ||
| + | numprocs=1 | ||
| + | redirect_stderr=true | ||
| + | stdout_logfile=/ | ||
| + | </ | ||
| + | |||
| + | Puis | ||
| + | < | ||
| + | # supervisorctl | ||
| + | supervisor> | ||
| + | monapp_prod-worker: | ||
| + | supervisor> | ||
| + | monapp_prod-worker: | ||
| + | supervisor> | ||
| + | monapp_prod-worker: | ||
| + | supervisor> | ||
| + | monapp_prod-worker: | ||
| + | </ | ||