Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email error #40

Open
deboy69 opened this issue Nov 4, 2022 · 7 comments
Open

email error #40

deboy69 opened this issue Nov 4, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@deboy69
Copy link

deboy69 commented Nov 4, 2022

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
wger | sys.exit(program.run())
wger | File "/usr/local/lib/python3.10/dist-packages/invoke/program.py", line 384, in run
wger | self.execute()
wger | File "/usr/local/lib/python3.10/dist-packages/invoke/program.py", line 569, in execute
wger | executor.execute(*self.tasks)
wger | File "/usr/local/lib/python3.10/dist-packages/invoke/executor.py", line 129, in execute
wger | result = call.task(*args, **call.kwargs)
wger | File "/usr/local/lib/python3.10/dist-packages/invoke/tasks.py", line 127, in call
wger | result = self.body(*args, **kwargs)
wger | File "/home/wger/src/wger/tasks.py", line 91, in bootstrap
wger | setup_django_environment(settings_path)
wger | File "/home/wger/src/wger/tasks.py", line 345, in setup_django_environment
wger | django.setup()
wger | File "/usr/local/lib/python3.10/dist-packages/django/init.py", line 19, in setup
wger | configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
wger | File "/usr/local/lib/python3.10/dist-packages/django/conf/init.py", line 82, in getattr
wger | self._setup(name)
wger | File "/usr/local/lib/python3.10/dist-packages/django/conf/init.py", line 69, in _setup
wger | self._wrapped = Settings(settings_module)
wger | File "/usr/local/lib/python3.10/dist-packages/django/conf/init.py", line 170, in init
wger | mod = importlib.import_module(self.SETTINGS_MODULE)
wger | File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
wger | return _bootstrap._gcd_import(name[level:], package, level)
wger | File "", line 1050, in _gcd_import
wger | File "", line 1027, in _find_and_load
wger | File "", line 1006, in _find_and_load_unlocked
wger | File "", line 688, in _load_unlocked
wger | File "", line 883, in exec_module
wger | File "", line 241, in _call_with_frames_removed
wger | File "/home/wger/src/settings.py", line 90, in
wger | WGER_SETTINGS['EMAIL_FROM'] = f'wger Workout Manager <{env.str("FROM_EMAIL")}>'
wger | File "/usr/local/lib/python3.10/dist-packages/environ/environ.py", line 213, in str
wger | value = self.get_value(var, cast=str, default=default)
wger | File "/usr/local/lib/python3.10/dist-packages/environ/environ.py", line 407, in get_value
wger | raise ImproperlyConfigured(error_msg) from exc
wger | django.core.exceptions.ImproperlyConfigured: Set the FROM_EMAIL environment variable

@rolandgeider rolandgeider added the bug Something isn't working label Nov 6, 2022
@rolandgeider
Copy link
Member

There was another issue about the EMAIL_FROM key not being used, this is probably something related to that

@deboy69
Copy link
Author

deboy69 commented Nov 17, 2022

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)

@rolandgeider
Copy link
Member

mhhhh, this works fine here

@Elu43
Copy link

Elu43 commented Jan 13, 2023

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

@rolandgeider
Copy link
Member

I will try to see if I can get this to fail on my machine

@Elu43
Copy link

Elu43 commented Jan 16, 2023

I did a workaround by giving up on the prod.env and putting all the environment variables directly in my docker compose.

@rolandgeider
Copy link
Member

but that shouldn't make any difference, it's just more convenient to use the file 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants