mirror of
https://github.com/ae-utbm/sith.git
synced 2025-03-10 07:17:11 +00:00
Apply review comments
This commit is contained in:
parent
e542fe11b9
commit
728ad157e9
2
.gitignore
vendored
2
.gitignore
vendored
@ -18,10 +18,10 @@ sith/search_indexes/
|
|||||||
.coverage
|
.coverage
|
||||||
coverage_report/
|
coverage_report/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
.env
|
||||||
|
|
||||||
# compiled documentation
|
# compiled documentation
|
||||||
site/
|
site/
|
||||||
.env
|
|
||||||
|
|
||||||
### Redis ###
|
### Redis ###
|
||||||
|
|
||||||
|
@ -85,13 +85,21 @@ des services externes (redis, vite et autres futures).
|
|||||||
En mode production, il est nécessaire de le désactiver puisque normalement
|
En mode production, il est nécessaire de le désactiver puisque normalement
|
||||||
tous ces services sont déjà configurés.
|
tous ces services sont déjà configurés.
|
||||||
|
|
||||||
Pour désactiver Honcho il suffit de sélectionner aucun `PROCFILE_` dans la config.
|
Pour désactiver Honcho il suffit de ne sélectionner aucun `PROCFILE_` dans la config.
|
||||||
|
|
||||||
```dotenv
|
```dotenv
|
||||||
PROCFILE_RUNSERVER=
|
PROCFILE_RUNSERVER=
|
||||||
PROCFILE_PYTEST=
|
PROCFILE_PYTEST=
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
Si honcho ne tourne plus, la recompilation automatique
|
||||||
|
des fichiers statiques ne se fait plus.
|
||||||
|
Si vous en avez besoin et que vous travaillez sans honcho,
|
||||||
|
vous devez ouvrir une autre fenêtre de votre terminal
|
||||||
|
et lancer la commande `npm run serve`
|
||||||
|
|
||||||
## Configurer Redis en service externe
|
## Configurer Redis en service externe
|
||||||
|
|
||||||
Redis est installé comme dépendance mais pas lancé par défaut.
|
Redis est installé comme dépendance mais pas lancé par défaut.
|
||||||
|
@ -2,6 +2,7 @@ import logging
|
|||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ def is_composer_running() -> bool:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def start_composer(procfile: str):
|
def start_composer(procfile: Path):
|
||||||
"""Starts the composer and stores the PID as an environment variable
|
"""Starts the composer and stores the PID as an environment variable
|
||||||
This allows for running smoothly with the django reloader
|
This allows for running smoothly with the django reloader
|
||||||
"""
|
"""
|
||||||
@ -51,7 +52,7 @@ def start_composer(procfile: str):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
[sys.executable, "-m", "honcho", "-f", procfile, "start"],
|
[sys.executable, "-m", "honcho", "-f", str(procfile), "start"],
|
||||||
)
|
)
|
||||||
write_pid(process.pid)
|
write_pid(process.pid)
|
||||||
|
|
||||||
|
@ -50,11 +50,22 @@ from .honeypot import custom_honeypot_error
|
|||||||
env = Env()
|
env = Env()
|
||||||
env.read_env()
|
env.read_env()
|
||||||
|
|
||||||
|
|
||||||
|
@env.parser_for("optional_file")
|
||||||
|
def optional_file_parser(value: str) -> Path | None:
|
||||||
|
if not value:
|
||||||
|
return None
|
||||||
|
path = Path(value)
|
||||||
|
if not path.is_file():
|
||||||
|
return None
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).parent.parent.resolve()
|
BASE_DIR = Path(__file__).parent.parent.resolve()
|
||||||
|
|
||||||
# Composer settings
|
# Composer settings
|
||||||
PROCFILE_RUNSERVER = env.str("PROCFILE_RUNSERVER", None)
|
PROCFILE_RUNSERVER = env.optional_file("PROCFILE_RUNSERVER", None)
|
||||||
PROCFILE_PYTEST = env.str("PROCFILE_PYTEST", None)
|
PROCFILE_PYTEST = env.optional_file("PROCFILE_PYTEST", None)
|
||||||
|
|
||||||
## File path used to avoid running the composer multiple times at the same time
|
## File path used to avoid running the composer multiple times at the same time
|
||||||
COMPOSER_PID_PATH = env.path("COMPOSER_PID_PATH", BASE_DIR / "composer.pid")
|
COMPOSER_PID_PATH = env.path("COMPOSER_PID_PATH", BASE_DIR / "composer.pid")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user