Browse Source

Conditionally add postgres app to INSTALLED_APPS (#587)

Arne Tarara 1 month ago
parent
commit
ca0f4a7d8a
1 changed files with 2 additions and 0 deletions
  1. 2 0
      bakerydemo/settings/base.py

+ 2 - 0
bakerydemo/settings/base.py

@@ -123,6 +123,8 @@ WSGI_APPLICATION = "bakerydemo.wsgi.application"
 
 if "DATABASE_URL" in os.environ:
     DATABASES = {"default": dj_database_url.config(conn_max_age=500)}
+    if os.environ["DATABASE_URL"].startswith("postgres://"):
+        INSTALLED_APPS.append("django.contrib.postgres")
 else:
     DATABASES = {
         "default": {