How are environment variables accessed from ".env" file if Django project deployed to AWS from Github?

I have a Django project deployed on AWS EBS from a Github repo. My secret key is kept on a .env file. I've included the following:

from decouple import config





Since I've include .env inside my .gitignore file, the .env is not being pushed to Github. When I try to deploy my project I keep getting an error:

"web: decouple.UndefinedValueError: SECRET_KEY not found". 

The project runs fine on a local server.

With Ashwini's help I was able to figure it out. You can store environment variables in AWS by using the cli:

Additionally, you can view and add environment variables through the AWS dashboard: Elastic Beanstalk / Click on your environment hyperlink / Click "Configuration" (on the left side of the page) / Click the "Edit" button under the software section.

Back to Top