Self hosted FLOSS fitness/workout, nutrition and weight tracker
Add flag to disable global celery use
Roland Geiderda52c55433a9
diff --git a/extras/docker/development/settings.py b/extras/docker/development/settings.pyindex 94c9b731c..08a038bee 100644--- a/extras/docker/development/settings.py+++ b/extras/docker/development/settings.py@@ -95,6 +95,7 @@ WGER_SETTINGS["ALLOW_REGISTRATION"] = env.bool("ALLOW_REGISTRATION", True)WGER_SETTINGS["ALLOW_GUEST_USERS"] = env.bool("ALLOW_GUEST_USERS", True)WGER_SETTINGS["ALLOW_UPLOAD_VIDEOS"] = env.bool("ALLOW_UPLOAD_VIDEOS", True)WGER_SETTINGS["EXERCISE_CACHE_TTL"] = env.int("EXERCISE_CACHE_TTL", 3600)+WGER_SETTINGS["USE_CELERY"] = env.bool("USE_CELERY", False)# Cachediff --git a/wger/nutrition/management/commands/download-off-ingredient-images.py b/wger/nutrition/management/commands/download-off-ingredient-images.pyindex 21549ec2b..cadc5d4cb 100644--- a/wger/nutrition/management/commands/download-off-ingredient-images.py+++ b/wger/nutrition/management/commands/download-off-ingredient-images.py@@ -36,6 +36,9 @@ class Command(BaseCommand):help = 'Download images of all Open Food Facts ingredients that are used in a nutrition plan'def handle(self, **options):+ if not settings.WGER_SETTINGS['USE_CELERY']:+ return+# Make sure off downloads are enabledsettings.WGER_SETTINGS['DOWNLOAD_FROM_OFF'] = Truediff --git a/wger/nutrition/models/ingredient.py b/wger/nutrition/models/ingredient.pyindex c5fa135ee..143956508 100644--- a/wger/nutrition/models/ingredient.py+++ b/wger/nutrition/models/ingredient.py@@ -448,5 +448,8 @@ class Ingredient(AbstractSubmissionModel, AbstractLicenseModel, models.Model):if not request.user.is_authenticated:return+ if not settings.WGER_SETTINGS['USE_CELERY']:+ return+# Let celery fetch the imagefetch_ingredient_image.delay(self.pk)diff --git a/wger/settings_global.py b/wger/settings_global.pyindex 57dfc9973..f2f3f3e9c 100644--- a/wger/settings_global.py+++ b/wger/settings_global.py@@ -482,6 +482,7 @@ WGER_SETTINGS = {'ALLOW_GUEST_USERS': True,'ALLOW_REGISTRATION': True,'ALLOW_UPLOAD_VIDEOS': False,+ 'USE_CELERY': False,'EMAIL_FROM': 'wger Workout Manager <[email protected]>','EXERCISE_CACHE_TTL': 3600,'TWITTER': False,@@ -513,6 +514,5 @@ ACTSTREAM_SETTINGS = {'USE_JSONFIELD': True,}-# Whether the application is being run regularly or during testsTESTING = len(sys.argv) > 1 and sys.argv[1] == 'test'