Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Merge branch 'master' into feature/ingredient-images

Roland Geiderdda73ec2fafc
diff --cc extras/docker/development/settings.py
index 866dcfc1d,0b6707dc9..e2d1408bf
--- a/extras/docker/development/settings.py
+++ b/extras/docker/development/settings.py
@@@ -85,19 -83,18 +84,21 @@@ if os.environ.get("ENABLE_EMAIL")
EMAIL_USE_SSL = env.bool("EMAIL_USE_SSL", True)
EMAIL_TIMEOUT = 60
+
# Sender address used for sent emails
- WGER_SETTINGS['EMAIL_FROM'] = f'wger Workout Manager <{env.str("FROM_EMAIL")}>'
- DEFAULT_FROM_EMAIL = WGER_SETTINGS['EMAIL_FROM']
+ DEFAULT_FROM_EMAIL = env.str("FROM_EMAIL", "wger Workout Manager <[email protected]>")
+ WGER_SETTINGS['EMAIL_FROM'] = DEFAULT_FROM_EMAIL
+ SERVER_EMAIL = DEFAULT_FROM_EMAIL
+ EMAIL_FROM_ADDRESS = DEFAULT_FROM_EMAIL
# Management
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["MIN_ACCOUNT_AGE_TO_TRUST"] = env.int("MIN_ACCOUNT_AGE_TO_TRUST", 21) # in days
+ WGER_SETTINGS["MIN_ACCOUNT_AGE_TO_TRUST"] = env.int("MIN_ACCOUNT_AGE_TO_TRUST", 21) # in days
WGER_SETTINGS["EXERCISE_CACHE_TTL"] = env.int("EXERCISE_CACHE_TTL", 3600)
+WGER_SETTINGS["USE_CELERY"] = env.bool("USE_CELERY", False)
+
# Cache
if os.environ.get("DJANGO_CACHE_BACKEND"):
@@@ -137,10 -133,13 +137,19 @@@ SIMPLE_JWT['SIGNING_KEY'] = env.str("SI
#
# https://docs.djangoproject.com/en/4.1/ref/csrf/
#
- CSRF_TRUSTED_ORIGINS = env.list("CSRF_TRUSTED_ORIGINS", ['http://127.0.0.1', ])
+ CSRF_TRUSTED_ORIGINS = env.list(
+ "CSRF_TRUSTED_ORIGINS",
+ default=['http://127.0.0.1', 'http://localhost', 'https://localhost'],
+ )
+
+ if env.bool('X_FORWARDED_PROTO_HEADER_SET', False):
+ SECURE_PROXY_SSL_HEADER = (
+ env.str('SECURE_PROXY_SSL_HEADER', 'HTTP_X_FORWARDED_PROTO'),
+ 'https'
+ )
+
+#
+# Celery message queue configuration
+#
+CELERY_BROKER_URL = env.str("CELERY_BROKER", "redis://cache:6379/1")
+CELERY_RESULT_BACKEND = env.str("CELERY_BACKEND", "redis://cache:6379/1")
diff --cc requirements.txt
index 331a50c6f,696e27dc5..876a70269
--- a/requirements.txt
+++ b/requirements.txt
@@@ -20,16 -20,13 +20,16 @@@ django_compressor~=4.
django_extensions~=3.2
django-storages~=1.13
django-environ==0.9.0
- easy-thumbnails==2.8.3
- fontawesomefree~=6.2.1
+ easy-thumbnails==2.8.5
+ fontawesomefree~=6.3.0
icalendar==4.1.0
- invoke==1.7.3
- pillow==9.3.0
+ invoke==2.0.0
+ pillow==9.4.0
reportlab==3.6.12
- requests==2.28.1
+ requests==2.28.2
+celery==5.2.7
+redis==4.3.4
+flower==1.2.0
tzdata==2022.7
diff --cc wger/exercises/management/commands/download-exercise-images.py
index 3694148e5,dba82261a..7fca7974c
--- a/wger/exercises/management/commands/download-exercise-images.py
+++ b/wger/exercises/management/commands/download-exercise-images.py
@@@ -39,9 -41,9 +39,9 @@@ from wger.exercises.models import
ExerciseBase,
ExerciseImage,
)
-
+from wger.utils.requests import wger_headers
- IMAGE_API = "{0}/api/v2/exerciseimage/?status=2"
+ IMAGE_API = "{0}/api/v2/exerciseimage/"
class Command(BaseCommand):
diff --cc wger/exercises/management/commands/sync-exercises.py
index 0fc25e12e,11aa5493f..460720118
--- a/wger/exercises/management/commands/sync-exercises.py
+++ b/wger/exercises/management/commands/sync-exercises.py
@@@ -24,20 -22,28 +22,27 @@@ from django.core.validators import URLV
# Third Party
import requests
-from requests.utils import default_user_agent
# wger
+ from wger import get_version
+ from wger.core.models import Language
from wger.exercises.models import (
+ DeletionLog,
Equipment,
Exercise,
ExerciseBase,
ExerciseCategory,
+ ExerciseImage,
+ ExerciseVideo,
Muscle,
)
-
+from wger.utils.requests import wger_headers
- EXERCISE_API = "{0}/api/v2/exerciseinfo/?limit=100"
+ EXERCISE_API = "{0}/api/v2/exercisebaseinfo/?limit=100"
+ DELETION_LOG_API = "{0}/api/v2/deletion-log/?limit=100"
CATEGORY_API = "{0}/api/v2/exercisecategory/"
MUSCLE_API = "{0}/api/v2/muscle/"
+ LANGUAGE_API = "{0}/api/v2/language/"
EQUIPMENT_API = "{0}/api/v2/equipment/"
@@@ -75,13 -94,20 +93,18 @@@ class Command(BaseCommand)
except ValidationError:
raise CommandError('Please enter a valid URL')
- headers = wger_headers()
- self.sync_categories(headers, remote_url)
- self.sync_muscles(headers, remote_url)
- self.sync_equipment(headers, remote_url)
- self.sync_exercises(headers, remote_url)
- self.headers = {
- 'User-agent': default_user_agent('wger/{} + requests'.format(get_version()))
- }
++ self.headers = wger_headers()
+
+ # Process everything
+ self.sync_languages()
+ self.sync_categories()
+ self.sync_muscles()
+ self.sync_equipment()
+ self.sync_exercises()
+ if not options['skip_delete']:
+ self.delete_entries()
- def sync_exercises(self, headers: dict, remote_url: str):
+ def sync_exercises(self):
"""Synchronize the exercises from the remote server"""
self.stdout.write('*** Synchronizing exercises...')