TL;DR
This answer assumes you have installed EB CLI. Follow these steps:
- Connect to your running instance using ssh.
eb ssh <environment-name>
- Once you are inside your environment, load the environment variables (this is important for database configuration)
. /opt/python/current/env
If you wish you can see the environment variables using printenv
.
- Activate your virtual environment
source /opt/python/run/venv/bin/activate
- Navigate to your project directory (this will depend on your latest deployment, so use the number of your latest deployment instead of
XX
)
cd /opt/python/bundle/XX/app/
- Run the command you wish:
python manage.py <command_name>
Running example
Asumming that your environment name is my-env
, your latest deployment number is 13
, and you want to run the shell
command:
eb ssh my-env # 1
. /opt/python/current/env # 2
source /opt/python/run/venv/bin/activate # 3
cd /opt/python/bundle/13/app/ # 4
python manage.py shell # 5