[Django]-Run Django commands on Elastic Beanstalk SSH -> Missing environment variables

9👍

Your env variables are stored in /opt/elasticbeanstalk/deployment/env

Thus to export them, you can do the following (must be root to access the file):

export $(cat /opt/elasticbeanstalk/deployment/env | xargs)

Once you execute the command you can confirm the presence of your env variables using:

env

To use this in your .extentions, you can try:

container_commands:
  10_dumpdata:
    command: |
      export $(cat /opt/elasticbeanstalk/deployment/env | xargs)
      source $PYTHONPATH/activate
      python ./manage.py dumpdata
👤Marcin

Leave a comment