From 835067772b1fe3fcc2471818605f4de99acb252c Mon Sep 17 00:00:00 2001 From: Domenico DiNicola Date: Mon, 18 Dec 2023 12:58:58 +0100 Subject: [PATCH] fix upgrade --- docker/bin/entrypoint.sh | 2 +- docker/conf/uwsgi.ini | 2 +- src/aurora/management/commands/upgrade.py | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docker/bin/entrypoint.sh b/docker/bin/entrypoint.sh index 889401f8..09cc929c 100755 --- a/docker/bin/entrypoint.sh +++ b/docker/bin/entrypoint.sh @@ -7,13 +7,13 @@ export REDIS_MAXMEMORY="${REDIS_MAXMEMORY:-100Mb}" export REDIS_MAXMEMORY_POLICY="${REDIS_MAXMEMORY_POLICY:-volatile-ttl}" export AURORA_VERSION=${VERSION} export AURORA_BUILD=${BUILD_DATE} +export PYTHONPATH="/code/src/:/code/__pypackages__/3.11/lib" export DOLLAR='$' mkdir -p /var/run /var/nginx ${NGINX_CACHE_DIR} ${MEDIA_ROOT} ${STATIC_ROOT} echo "created support dirs /var/run ${MEDIA_ROOT} ${STATIC_ROOT}" - if [ $# -eq 0 ]; then envsubst < /conf/nginx.conf.tpl > /conf/nginx.conf && nginx -tc /conf/nginx.conf envsubst < /conf/redis.conf.tpl > /conf/redis.conf diff --git a/docker/conf/uwsgi.ini b/docker/conf/uwsgi.ini index e7f505d6..0da0ee79 100644 --- a/docker/conf/uwsgi.ini +++ b/docker/conf/uwsgi.ini @@ -1,7 +1,7 @@ [uwsgi] http-socket=0.0.0.0:8000 -env=PYTHONPATH=/code/src +env=PYTHONPATH=/code/src/:/code/__pypackages__/3.11/lib enable-threads=0 honour-range=1 master=1 diff --git a/src/aurora/management/commands/upgrade.py b/src/aurora/management/commands/upgrade.py index 7ef07e39..58c0550e 100644 --- a/src/aurora/management/commands/upgrade.py +++ b/src/aurora/management/commands/upgrade.py @@ -45,15 +45,6 @@ def upgrade(admin_email, admin_password, static, migrate, prompt, verbosity, org extra = {"no_input": prompt, "verbosity": verbosity - 1, "stdout": None} click.echo("Run upgrade.. waiting for lock") try: - # ensure project/org - click.echo("Set default Org/Project") - UNICEF, __ = Organization.objects.get_or_create(slug="unicef", defaults={"name": "UNICEF"}) - DEF, __ = Project.objects.get_or_create(slug="default-project", organization=UNICEF) - - Project.objects.filter(organization__isnull=True).update(organization=UNICEF) - Registration.objects.filter(project__isnull=True).update(project=DEF) - FlexForm.objects.filter(project__isnull=True).update(project=DEF) - with cache.lock(env("MIGRATION_LOCK_KEY"), timeout=60 * 10, blocking_timeout=2, version=VERSION): if migrate: if verbosity >= 1: @@ -61,6 +52,15 @@ def upgrade(admin_email, admin_password, static, migrate, prompt, verbosity, org call_command("migrate", **extra) call_command("create_extra_permissions") + # ensure project/org + click.echo("Set default Org/Project") + UNICEF, __ = Organization.objects.get_or_create(slug="unicef", defaults={"name": "UNICEF"}) + DEF, __ = Project.objects.get_or_create(slug="default-project", organization=UNICEF) + + Project.objects.filter(organization__isnull=True).update(organization=UNICEF) + Registration.objects.filter(project__isnull=True).update(project=DEF) + FlexForm.objects.filter(project__isnull=True).update(project=DEF) + static_root = Path(env("STATIC_ROOT")) if not static_root.exists(): static_root.mkdir(parents=True)