Deploy Django Application to Elastic Beanstalk

, , Leave a comment

Ensure the EC2 Instance Allows Traffic 

Launch a Docker Container and Update

  1. docker run -it -p 80:80 ubuntu /bin/bash
  2. apt-get update
  3. apt-get upgrade
  4. apt-get dist-upgrade
  5. Install Python 2.7, Pip, Amazon Command Line Interface (AWS CLI) and 

  6. apt-get install python2.7
  7. apt-get install curl
  8. curl -O https://bootstrap.pypa.io/get-pip.py
  9. python2.7 get-pip.py
  10. apt-get install python-cryptography
  11. pip isntall aws
  12. pip install –upgrade –user awsebcli
  13. PATH=$PATH:~/.local/bin; export PATH
  14. Install and Create Virtualenv 

  15. pip install virtualenv
  16. ~/eb-virt
  17. virtualenv ~/eb-virt
  18. source ~/eb-virt/bin/activate
  19. Install Django

  20. pip install django==1.9.2
  21. Start a Django Project

  22. django-admin startproject ebdjango
  23. Deploy Your Site

  24. pip freeze > requirements.txt
  25. mkdir .ebextensions
  26. vi .ebextensions/django.config
  27. option_settings:
      aws:elasticbeanstalk:container:python:
        WSGIPath: ebdjango/wsgi.pyo
  28. eb init -p python2.7 django-tutorial # you’ll be asked for your keys
  29. eb create django-env
  30. eb open
 

Leave a Reply