Skip to content

Commit 91c4a3e

Browse files
authored
Align tasks.py to geonode core (#563)
Backport GeoNode/geonode@8c0ade7
1 parent 57a64bd commit 91c4a3e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/tasks.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import ipaddress
2828
import logging
2929
import datetime
30+
from pathlib import Path
3031

3132
from urllib.parse import urlparse, urlunparse
3233
from invoke import task
@@ -353,7 +354,11 @@ def migrations(ctx):
353354
def statics(ctx):
354355
print("**************************statics*******************************")
355356
try:
356-
ctx.run("mkdir -p /mnt/volumes/statics/{static,uploads}")
357+
static_root = os.environ.get("STATIC_ROOT", "/mnt/volumes/statics/static/")
358+
media_root = os.environ.get("MEDIA_ROOT", "/mnt/volumes/statics/uploaded/")
359+
assets_root = os.environ.get("ASSETS_ROOT", "/mnt/volumes/statics/assets/")
360+
361+
ctx.run(f"mkdir -pv {static_root} {media_root} {assets_root}")
357362
ctx.run(
358363
f"python manage.py collectstatic --noinput --settings={_localsettings()}",
359364
pty=True,
@@ -469,7 +474,9 @@ def collectmetrics(ctx):
469474
@task
470475
def initialized(ctx):
471476
print("**************************init file********************************")
472-
ctx.run("date > /mnt/volumes/statics/geonode_init.lock")
477+
static_root = os.environ.get("STATIC_ROOT", "/mnt/volumes/statics/static/")
478+
lockfile_dir = Path(static_root).parent # quite ugly, we're assuming such dir exists and is writable
479+
ctx.run(f"date > {lockfile_dir}/geonode_init.lock")
473480

474481

475482
def _docker_host_ip():

0 commit comments

Comments
 (0)