diff --git a/src/country_workspace/config/fragments/kobo.py b/src/country_workspace/config/fragments/kobo.py new file mode 100644 index 0000000..8ecc14b --- /dev/null +++ b/src/country_workspace/config/fragments/kobo.py @@ -0,0 +1,4 @@ +from .. import env + +KOBO_BASE_URL = env("KOBO_BASE_URL") +KOBO_TOKEN = env("KOBO_TOKEN") diff --git a/src/country_workspace/config/settings.py b/src/country_workspace/config/settings.py index f3600dd..6c81838 100644 --- a/src/country_workspace/config/settings.py +++ b/src/country_workspace/config/settings.py @@ -229,6 +229,7 @@ from .fragments.rest_framework import * # noqa from .fragments.root import * # noqa from .fragments.sentry import * # noqa +from .fragments.kobo import * # noqa # from .fragments.smart_admin import * # noqa from .fragments.social_auth import * # noqa diff --git a/src/country_workspace/tasks.py b/src/country_workspace/tasks.py index 884139b..5f5ae5f 100644 --- a/src/country_workspace/tasks.py +++ b/src/country_workspace/tasks.py @@ -2,8 +2,8 @@ import logging from typing import TYPE_CHECKING, Any +from constance import config from django.core.cache import cache - import sentry_sdk from redis_lock import Lock @@ -67,7 +67,7 @@ def removed_expired_jobs(**kwargs): @app.task def sync_kobo_assets_task(job_id: int, version: int) -> None: _ = KoboSyncJob.objects.get(pk=job_id, version=version) - client = KoboClient(base_url="https://kf-hope-stg.unitst.org", token="01f1a122ddad12d7e72f3b86e9d8a637c917bee8") + client = KoboClient(base_url=config.KOBO_BASE_URL, token=config.KOBO_TOKEN) for asset_data in client.assets: asset_model, _ = KoboAsset.objects.update_or_create(uid=asset_data.uid, defaults={"name": asset_data.name})