mirror of
https://github.com/RunLit/Bambu-Run.git
synced 2026-10-21 15:37:38 +01:00
capability to point to local postgres db
:
This commit is contained in:
@@ -87,6 +87,15 @@ else:
|
||||
}
|
||||
}
|
||||
|
||||
# Session storage — DB-backed by default. Set SESSION_ENGINE=signed_cookies when
|
||||
# pointing DB_ENGINE at a database whose user has read-only access, since the
|
||||
# default engine writes a row to django_session on every login.
|
||||
SESSION_ENGINE = (
|
||||
"django.contrib.sessions.backends.signed_cookies"
|
||||
if os.environ.get("SESSION_ENGINE") == "signed_cookies"
|
||||
else "django.contrib.sessions.backends.db"
|
||||
)
|
||||
|
||||
# Password validation
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"},
|
||||
|
||||
@@ -7,3 +7,15 @@ from django.core.wsgi import get_wsgi_application
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "standalone.settings")
|
||||
|
||||
application = get_wsgi_application()
|
||||
|
||||
# Read-only deployments (SESSION_ENGINE=signed_cookies) point at a database
|
||||
# whose user has no write access. Django writes to auth_user.last_login on
|
||||
# every successful login by default, which would error out against such a
|
||||
# user and break login entirely — so skip that write here.
|
||||
from django.conf import settings # noqa: E402
|
||||
|
||||
if settings.SESSION_ENGINE == "django.contrib.sessions.backends.signed_cookies":
|
||||
from django.contrib.auth.models import update_last_login
|
||||
from django.contrib.auth.signals import user_logged_in
|
||||
|
||||
user_logged_in.disconnect(update_last_login, dispatch_uid="update_last_login")
|
||||
|
||||
Reference in New Issue
Block a user