mirror of
https://github.com/ae-utbm/sith.git
synced 2025-03-09 23:07:11 +00:00
Apply review comments
This commit is contained in:
parent
7f8304e407
commit
aa66fc61ab
@ -77,7 +77,22 @@ uv sync --group prod
|
||||
C'est parce que ces dépendances compilent certains modules
|
||||
à l'installation.
|
||||
|
||||
## Configurer Redis
|
||||
## Désactiver Honcho
|
||||
|
||||
Honcho est utilisé en développement pour simplifier la gestion
|
||||
des services externes (redis, vite et autres futures).
|
||||
|
||||
En mode production, il est nécessaire de le désactiver puisque normalement
|
||||
tous ces services sont déjà configurés.
|
||||
|
||||
Pour désactiver Honcho il suffit de sélectionner aucun `PROCFILE_` dans la config.
|
||||
|
||||
```dotenv
|
||||
PROCFILE_RUNSERVER=
|
||||
PROCFILE_PYTEST=
|
||||
```
|
||||
|
||||
## Configurer Redis en service externe
|
||||
|
||||
Redis est installé comme dépendance mais pas lancé par défaut.
|
||||
|
||||
@ -100,6 +115,11 @@ REDIS_PORT=6379
|
||||
CACHE_URL=redis://127.0.0.1:${REDIS_PORT}/0
|
||||
```
|
||||
|
||||
Si on souhaite configurer redis pour communiquer via un socket :
|
||||
|
||||
```dovenv
|
||||
CACHE_URL=redis:///path/to/redis-server.sock
|
||||
```
|
||||
|
||||
## Configurer PostgreSQL
|
||||
|
||||
|
11
manage.py
11
manage.py
@ -18,19 +18,16 @@ import sys
|
||||
|
||||
from django.utils.autoreload import DJANGO_AUTORELOAD_ENV
|
||||
|
||||
from processes.composer import start_composer, stop_composer
|
||||
from sith.environ import env
|
||||
from sith.composer import start_composer, stop_composer
|
||||
from sith.settings import PROCFILE_RUNSERVER
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sith.settings")
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
if (
|
||||
os.environ.get(DJANGO_AUTORELOAD_ENV) is None
|
||||
and (procfile := env.str("PROCFILE_RUNSERVER", None)) is not None
|
||||
):
|
||||
start_composer(procfile)
|
||||
if os.environ.get(DJANGO_AUTORELOAD_ENV) is None and PROCFILE_RUNSERVER is not None:
|
||||
start_composer(PROCFILE_RUNSERVER)
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
@ -126,6 +126,10 @@ ignore = [
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
convention = "google"
|
||||
|
||||
[build-system] # A build system is needed to register a pytest plugin
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[project.entry-points.pytest11]
|
||||
sith = "sith.pytest"
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
from environs import Env
|
||||
|
||||
env = Env()
|
||||
_ = env.read_env()
|
@ -1,10 +1,8 @@
|
||||
import pytest
|
||||
|
||||
from processes.composer import start_composer, stop_composer
|
||||
from .composer import start_composer, stop_composer
|
||||
from .settings import PROCFILE_PYTEST
|
||||
|
||||
from .environ import env
|
||||
|
||||
# pytest-django uses the load_initial_conftest hook
|
||||
# it's the first hook loaded by pytest and can only
|
||||
# be defined in a proper pytest plugin
|
||||
# To use the composer before pytest-django loads
|
||||
@ -15,8 +13,8 @@ from .environ import env
|
||||
@pytest.hookimpl(tryfirst=True)
|
||||
def pytest_load_initial_conftests(early_config, parser, args):
|
||||
"""Hook that loads the composer before the pytest-django plugin"""
|
||||
if (procfile := env.str("PROCFILE_PYTEST", None)) is not None:
|
||||
start_composer(procfile)
|
||||
if PROCFILE_PYTEST is not None:
|
||||
start_composer(PROCFILE_PYTEST)
|
||||
|
||||
|
||||
def pytest_unconfigure(config):
|
||||
|
@ -42,13 +42,20 @@ from pathlib import Path
|
||||
import sentry_sdk
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from environs import Env
|
||||
from sentry_sdk.integrations.django import DjangoIntegration
|
||||
|
||||
from .environ import env
|
||||
from .honeypot import custom_honeypot_error
|
||||
|
||||
env = Env()
|
||||
env.read_env()
|
||||
|
||||
BASE_DIR = Path(__file__).parent.parent.resolve()
|
||||
|
||||
# Composer settings
|
||||
PROCFILE_RUNSERVER = env.str("PROCFILE_RUNSERVER", None)
|
||||
PROCFILE_PYTEST = env.str("PROCFILE_PYTEST", None)
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user