From f57eb85b20bebc0c1f7637dabdd228498812f4ed Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 5 Apr 2021 01:06:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Configure=20basic=20database?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sophon/settings.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sophon/settings.py b/sophon/settings.py index 79e0d86..6e3d03a 100644 --- a/sophon/settings.py +++ b/sophon/settings.py @@ -21,7 +21,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = os.environ["DJANGO_SECRET_KEY"] +SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY", "change-me-in-production") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = bool(os.environ.get("DJANGO_DEBUG")) @@ -77,11 +77,18 @@ WSGI_APPLICATION = 'sophon.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'ENGINE': 'django.db.backends.postgresql', + 'HOST': '', # Connect via UNIX socket (does not work on Windows) + 'NAME': 'sophon', + 'USER': 'sophon', # Connect using its own user, isolating sophon from the rest of the server } } +# Remember to run the following commands on a new installation: +# sudo -iu postgres +# createuser sophon +# createdb --owner=sophon sophon + # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators