Skip to content

Commit

Permalink
Merge pull request #124 from uktrade/feature/resolve-celery
Browse files Browse the repository at this point in the history
Add cache rebuild command and update database config logic
  • Loading branch information
gdbarnes authored Dec 13, 2024
2 parents bca1921 + b5f75af commit 7237a1b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
Empty file added app/core/management/__init__.py
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions app/core/management/commands/rebuildcache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.core.management import BaseCommand

from app.cache.manage_cache import rebuild_cache


class RebuildCache(BaseCommand):
help = "Rebuilds the cache"

def handle(self, *args, **options):
rebuild_cache()
41 changes: 20 additions & 21 deletions fbr/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import dj_database_url
import environ

from dbt_copilot_python.database import database_url_from_env
from django_log_formatter_asim import ASIMFormatter

# Define the root directory (i.e. <repo-root>)
Expand Down Expand Up @@ -111,27 +110,27 @@

DATABASES: dict = {}

DATABASES["default"] = dj_database_url.config( # noqa
default=database_url_from_env("DATABASE_CREDENTIALS")
)
# DATABASES["default"] = dj_database_url.config( # noqa
# default=database_url_from_env("DATABASE_CREDENTIALS")
# )

# if DATABASE_URL := env("DATABASE_URL", default=None):
# DATABASES = {
# "default": {
# **dj_database_url.parse(
# DATABASE_URL,
# engine="postgresql",
# ),
# "ENGINE": "django.db.backends.postgresql",
# }
# }
# else:
# DATABASES = {
# "default": {
# "ENGINE": "django.db.backends.sqlite3",
# "NAME": BASE_DIR / "db.sqlite3",
# }
# }
if DATABASE_URL := env("DATABASE_URL", default=None):
DATABASES = {
"default": {
**dj_database_url.parse(
DATABASE_URL,
engine="postgresql",
),
"ENGINE": "django.db.backends.postgresql",
}
}
else:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
}
}

AUTH_PASSWORD_VALIDATORS = [
{
Expand Down

0 comments on commit 7237a1b

Please sign in to comment.