Skip to content

Commit

Permalink
create DATABASE_URL env if none found (#2454)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra authored Nov 20, 2020
1 parent 1a1beaa commit dead5d8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions posthog/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ def print_warning(warning_lines: Sequence[str]):
"CONN_MAX_AGE": 0,
}
}
DATABASE_URL = "postgres://{}{}{}{}:{}/{}".format(
DATABASES["default"]["USER"],
":" + DATABASES["default"]["PASSWORD"] if DATABASES["default"]["PASSWORD"] else "",
"@" if DATABASES["default"]["USER"] or DATABASES["default"]["PASSWORD"] else "",
DATABASES["default"]["HOST"],
DATABASES["default"]["PORT"],
DATABASES["default"]["NAME"],
)
else:
raise ImproperlyConfigured(
f'The environment vars "DATABASE_URL" or "POSTHOG_DB_NAME" are absolutely required to run this software'
Expand Down

0 comments on commit dead5d8

Please sign in to comment.