mirror of
https://github.com/deunix-educ/PyQuest.git
synced 2026-11-25 08:19:44 +01:00
Add Django administration for author accounts: Auteurs group, use_editor permission, grant/revoke actions, shared login throttling
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,8 +9,11 @@ INSTALLED_APPS = [
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"django.contrib.admin",
|
||||
"sync",
|
||||
"authors",
|
||||
"authors.apps.AuthorsConfig",
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
@@ -20,16 +23,28 @@ MIDDLEWARE = [
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
]
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {"context_processors": ["django.template.context_processors.request"]},
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
]
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
# Fichiers statiques de l'administration, servis par nginx sous /api/static/ (python manage.py collectstatic).
|
||||
STATIC_URL = "/api/static/"
|
||||
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||
|
||||
# Session des auteurs (éditeur de niveaux) : cookie HttpOnly, 8 heures.
|
||||
SESSION_COOKIE_NAME = "pyquest_author"
|
||||
SESSION_COOKIE_AGE = 8 * 60 * 60
|
||||
|
||||
@@ -16,3 +16,6 @@ DATABASES = {
|
||||
"NAME": os.environ.get("PYQUEST_DB_PATH", BASE_DIR / "db.sqlite3"),
|
||||
}
|
||||
}
|
||||
|
||||
# Dossier des fichiers statiques collectés (essai avec nginx : scripts/local_stack.py).
|
||||
STATIC_ROOT = os.environ.get("PYQUEST_STATIC_ROOT", BASE_DIR / "staticfiles")
|
||||
|
||||
@@ -41,3 +41,4 @@ CSRF_TRUSTED_ORIGINS = [_required("PYQUEST_ORIGIN")]
|
||||
SESSION_COOKIE_SECURE = True
|
||||
CSRF_COOKIE_SECURE = True
|
||||
TRUST_REAL_IP_HEADER = True # nginx écrase X-Real-IP (voir nginx/pyquest.conf.example)
|
||||
STATIC_ROOT = os.environ.get("PYQUEST_STATIC_ROOT", "/var/www/pyquest/static") # servi par nginx : /api/static/
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
from django.urls import include, path
|
||||
|
||||
from authors.sites import site as admin_site
|
||||
|
||||
urlpatterns = [
|
||||
path("api/sync/", include("sync.urls")),
|
||||
path("api/auth/", include("authors.urls")),
|
||||
# Administration des comptes auteurs : sous /api/ pour passer par le même proxy nginx.
|
||||
path("api/admin/", admin_site.urls),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user