I want a cron job and everything is already set up and cron is also working but unfortunately, cron is not getting my environment variables. I'm getting my environment variables using os
and they're working fine across the project but not in my cron.
settings.py
SECRET_KEY = os.environ.get('SECRET_KEY')
# Cron Jobs
CRONJOBS = [
('* * * * *', 'projects.cron.notifications_cron', '>> /cron/django_cron.log 2<&1')
]
crontab -e
* * * * /usr/local/bin/python /app/manage.py crontab run 744fbefdbf3ad30bec13
error in log file
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
when I set the SECRET_KEY
hardcoded in my settings.py
then it is working fine but I want to get it from my environment variables.