postgres as a option

This commit is contained in:
Cayo Puigdefabregas 2023-12-12 13:22:43 +01:00
parent 5bb02bc375
commit f7a5ce52ee
2 changed files with 11 additions and 4 deletions

View file

@ -12,3 +12,4 @@ jinja2==3.1.2
jsonref==1.1.0 jsonref==1.1.0
pyld==2.0.3 pyld==2.0.3
more-itertools==10.1.0 more-itertools==10.1.0
dj-database-url==2.1.0

View file

@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
import os import os
from ast import literal_eval from ast import literal_eval
from dj_database_url import parse as db_url
from pathlib import Path from pathlib import Path
from django.contrib.messages import constants as messages from django.contrib.messages import constants as messages
@ -112,10 +113,15 @@ WSGI_APPLICATION = 'trustchain_idhub.wsgi.application'
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases # https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = { DATABASES = {
'default': { # 'default': {
'ENGINE': 'django.db.backends.sqlite3', # 'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3', # 'NAME': BASE_DIR / 'db.sqlite3',
} # }
'default': config(
'DATABASE_URL',
default='sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3'),
cast=db_url
)
# 'default': config( # 'default': config(
# 'DATABASE_URL', # 'DATABASE_URL',
# default='sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3'), # default='sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3'),