Monday, November 26, 2018

Elastic Beanstalk and manage.py

After many years of spinning up my own AWS EC2 instances to run Django, I thought I ought to finally try Elastic Beanstalk.

I use a lot of management commands in my workflow, like createsuperuser.  Surely there is an easy way to log into an EC2 instance after spinning up beanstalk to run these commands manually?

Yes. From this stackoverflow...
https://stackoverflow.com/questions/19997343/run-manage-py-from-aws-eb-linux-instance

  1. SSH login to Linux
    • (optional may need to run sudo su - to have proper permissions)
  2. Run source /opt/python/run/venv/bin/activate
  3. Run source /opt/python/current/env
  4. Run cd /opt/python/current/app
  5. Run python manage.py