Update settings.py

This commit is contained in:
Andros Fenollosa 2021-10-21 14:53:22 +02:00 committed by GitHub
parent f0bfd7affa
commit bd73794620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,22 +81,16 @@ TEMPLATES = [
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = { DATABASES = {
'default': { "default": {
'ENGINE': 'django.db.backends.sqlite3', "ENGINE": os.environ.get("DB_ENGINE"),
"NAME": os.path.join(BASE_DIR, os.environ.get("DB")), "NAME": os.environ.get("DB_NAME"),
"USER": os.environ.get("DB_USER"),
"PASSWORD": os.environ.get("DB_PASSWORD"),
"HOST": os.environ.get("DB_HOST"),
"PORT": os.environ.get("DB_PORT"),
} }
} }
def init_command_sqlite(sender, connection, **kwargs):
"""Enable initial config sqlite."""
if connection.vendor == "sqlite":
cursor = connection.cursor()
cursor.execute("PRAGMA locking_mode=exclusive;")
cursor.execute("PRAGMA journal_mode=wal;")
cursor.execute("PRAGMA synchronous=full;")
connection_created.connect(init_command_sqlite)
# Password validation # Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators