From ef6b87e9cd546a0d02617f787e63eb7c1deaa635 Mon Sep 17 00:00:00 2001 From: Daoud Clarke Date: Thu, 12 Oct 2023 21:44:34 +0100 Subject: [PATCH] Use a predeploy script instead --- app.json | 7 +++++++ mwmbl/apps.py | 11 ----------- 2 files changed, 7 insertions(+), 11 deletions(-) create mode 100644 app.json diff --git a/app.json b/app.json new file mode 100644 index 0000000..adbe94b --- /dev/null +++ b/app.json @@ -0,0 +1,7 @@ +{ + "scripts": { + "dokku": { + "predeploy": "rm -r /app/static/* && cp -r /front-end-build/* /app/static/", + } + } +} diff --git a/mwmbl/apps.py b/mwmbl/apps.py index fd2244d..f829ecc 100644 --- a/mwmbl/apps.py +++ b/mwmbl/apps.py @@ -35,14 +35,3 @@ class MwmblConfig(AppConfig): Process(target=background.run, args=(settings.DATA_PATH,)).start() Process(target=update_queue_continuously, args=(new_item_queue, queued_batches,)).start() Process(target=update_urls_continuously, args=(settings.DATA_PATH, new_item_queue)).start() - - if not settings.DEBUG: - # Remove all existing content from the static folder: - # https://stackoverflow.com/a/1073382 - for root, dirs, files in os.walk('/app/static'): - for f in files: - os.unlink(os.path.join(root, f)) - for d in dirs: - shutil.rmtree(os.path.join(root, d)) - - shutil.copytree('/front-end-build', '/app/static')