I'm attempting to assign sensitive data to environment variables. I have followed the article as posted here:
https://help.pythonanywhere.com/pages/environment-variables-for-web-apps/
Yet the key/value pairs that are declared in the .env
file aren't poulating as environment variables. When I deactivate and activate the virtualenv, Bash raises an error with regards to a paranthesis found in the secret key: bash: /home/binnybit/django_stackoverflow/.env: line 2: syntax error near unexpected token (
How can this error be resolved with respect to the random secret keys generated by Django which may conflict with Bash syntax?
(myvirtualenv) 02:57 ~ $ cat django_stackoverflow/.env
SECRET_KEY=*v#$%j7vkat%(&a+4*w67=miel-5yr%&q8s#k-b4+*o#jdsm8l
(myvirtualenv) 03:03 ~ $ echo 'set -a; source ~/django_stackoverflow/.env; set +a' >>
~/.virtualenvs/myvirtualenv/bin/postactivate
(myvirtualenv) 03:03 ~ $ echo $SECRET_KEY
(myvirtualenv) 03:04 ~ $ deactivate
03:04 ~ $ workon myvirtualenv
bash: /home/binnybit/django_stackoverflow/.env: line 2: syntax error near unexpected token `('
'ash: /home/binnybit/django_stackoverflow/.env: line 2: `SECRET_KEY=*v#$%j7vkat%(&a+4*w67=miel-
5yr%&q8s#k-b4+*o#jdsm8l