When hosting Django applications on AWS Elastic Beanstalk, it is often required to run commands on the server to do some maintenance tasks.

Beanstalk provisions EC2 instances which are running the web server processes. Django commands need to run in the same environment.

You might want to fix your shell first.

After connecting using SSH with

eb ssh

load the environment variables using

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

then load the Python environment using

source /var/app/venv

and finally run your Django command

python /var/app/current/manage.py runserver