docker
docker copied to clipboard
email error
wger | Traceback (most recent call last):
wger | File "/usr/local/lib/python3.10/dist-packages/environ/environ.py", line 403, in get_value
wger | value = self.ENVIRON[var_name]
wger | File "/usr/lib/python3.10/os.py", line 679, in getitem
wger | raise KeyError(key) from None
wger | KeyError: 'FROM_EMAIL'
wger |
wger | The above exception was the direct cause of the following exception:
wger |
wger | Traceback (most recent call last):
wger | File "/usr/local/bin/invoke", line 8, in
There was another issue about the EMAIL_FROM key not being used, this is probably something related to that
wger | WGER_SETTINGS['EMAIL_FROM'] = **f'**wger Workout Manager <{env.str("FROM_EMAIL")}>'
removed f in the settings.py. However it wont start to get into the container so I needed to turn on Django debug to get past the error. Not sure if it was a new container pull that had the fix in it or this actually fixed it. But got it up and running with two nginx containers. (main nginx and wger nginx)
mhhhh, this works fine here
Exact same error here :
django.core.exceptions.ImproperlyConfigured: Set the FROM_EMAIL environment variable
My prod.env:
# Django's secret key, change to a 50 character random string if you are running
# this instance publicly. For an online generator, see e.g. https://djecrety.ir/
SECRET_KEY=xxxxxxxxxxxxx
# Signing key used for JWT, use something different than the secret key
SIGNING_KEY=xxxxxxxxxxxx
# The 'from' address used when sending emails
[email protected]
# The server's timezone, for a list of possible names:
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TIME_ZONE=Europe/Paris
#
# Consult the deployment section in the readme if you are running this behind a
# reverse proxy with HTTPS enabled
#
CSRF_TRUSTED_ORIGINS=https://wger.xxxx.fr
X_FORWARDED_PROTO_HEADER_SET=True
#
# These settings usually don't need changing
#
#
# Application
ALLOW_REGISTRATION=True
ALLOW_GUEST_USERS=True
ALLOW_UPLOAD_VIDEOS=True
# Users won't be able to contribute to exercises if their account age is
# lower than this amount in days.
MIN_ACCOUNT_AGE_TO_TRUST=21
# Note that setting these to true will always perform a sync during startup,
# even if the data is already current and will take some time. Usually you don't
# need to perform these steps so often and a manual trigger (see README) is
# usually enough.
SYNC_EXERCISES_ON_STARTUP=False
DOWNLOAD_EXERCISE_IMAGES_ON_STARTUP=False
#
# Database
DJANGO_DB_ENGINE=django.db.backends.postgresql
DJANGO_DB_DATABASE=wger
DJANGO_DB_USER=wger
DJANGO_DB_PASSWORD=wger
DJANGO_DB_HOST=db
DJANGO_DB_PORT=5432
# Perform any new database migrations on startup
DJANGO_PERFORM_MIGRATIONS=True
#
# Cache
DJANGO_CACHE_BACKEND=django_redis.cache.RedisCache
DJANGO_CACHE_LOCATION=redis://cache:6379/1
# 60*60*24*15, 15 Days
DJANGO_CACHE_TIMEOUT=12
DJANGO_CACHE_CLIENT_CLASS=django_redis.client.DefaultClient
#
# Brute force login attacks
# https://django-axes.readthedocs.io/en/latest/index.html
AXES_ENABLED=True
AXES_FAILURE_LIMIT=10
# in minutes
AXES_COOLOFF_TIME=30
AXES_HANDLER=axes.handlers.cache.AxesCacheHandler
#
# Others
DJANGO_DEBUG=False
WGER_USE_GUNICORN=True
EXERCISE_CACHE_TTL=10
SITE_URL=http://localhost
#
# JWT auth
# The lifetime duration of the access token, in minutes
ACCESS_TOKEN_LIFETIME=10
# The lifetime duration of the refresh token, in hours
REFRESH_TOKEN_LIFETIME=24
#
# Other possible settings
# RECAPTCHA_PUBLIC_KEY
# RECAPTCHA_PRIVATE_KEY
# NOCAPTCHA
# https://docs.djangoproject.com/en/4.1/topics/email/#smtp-backend
# ENABLE_EMAIL
# EMAIL_HOST
# EMAIL_PORT
# EMAIL_HOST_USER
# EMAIL_HOST_PASSWORD
# EMAIL_USE_TLS
# EMAIL_USE_SSL
# DJANGO_MEDIA_ROOT
# DJANGO_STATIC_ROOT
I will try to see if I can get this to fail on my machine
I did a workaround by giving up on the prod.env and putting all the environment variables directly in my docker compose.
but that shouldn't make any difference, it's just more convenient to use the file 🤔