🚀(settings) standardize DATABASE_URL environment retrieval
(settings) standardize DATABASE_URL environment retrieval
This commit is contained in:
committed by
aleb_the_flash
parent
bfadeae6ee
commit
2c65cc061e
@@ -13,7 +13,7 @@ https://docs.djangoproject.com/en/3.1/ref/settings/
|
|||||||
# pylint: disable=too-many-lines
|
# pylint: disable=too-many-lines
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from os import environ, path
|
from os import path
|
||||||
from socket import gethostbyname, gethostname
|
from socket import gethostbyname, gethostname
|
||||||
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@@ -94,7 +94,9 @@ class Base(Configuration):
|
|||||||
# Database
|
# Database
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": dj_database_url.config()
|
"default": dj_database_url.config()
|
||||||
if environ.get("DATABASE_URL")
|
if values.DatabaseURLValue(
|
||||||
|
None, environ_name="DATABASE_URL", environ_prefix=None
|
||||||
|
)
|
||||||
else {
|
else {
|
||||||
"ENGINE": values.Value(
|
"ENGINE": values.Value(
|
||||||
"django.db.backends.postgresql_psycopg2",
|
"django.db.backends.postgresql_psycopg2",
|
||||||
|
|||||||
Reference in New Issue
Block a user