Django App Prerequisites for AWS Elastic Beanstalk: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Category:Django Category:AWS Category:Web Development == Install Python == Check for python and pip, and their versions: <syntaxhighlight lang="bash"> $ python -...") |
No edit summary |
||
| Line 53: | Line 53: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Install | == Install Django <ref>[http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html#python-django-install Install Django] (Deploying a Django Application - AWS Elastic Beanstalk)</ref> == | ||
(Make sure to use the virtual Python 3 environment.) | |||
<syntaxhighlight lang="bash"> | |||
$ pip install django | |||
</syntaxhighlight> | |||
Confirm the installation with | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ pip | $ pip freeze | grep -i django | ||
Django==1.9.2 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Deploying a Django app on AWS|Install the Django project]] [[Defining Django App Dependencies|and its dependencies]]. | |||
== Install | == Install AWS Elastic Beanstalk CLI <ref> [http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-common-steps.html#python-common-installing-ebcli Installing the AWS Elastic Beanstalk CLI] (AWS documentation)</ref> == | ||
<p class="alert alert-warning">I couldn't get the following command to work until I switched to the Python 3.4 virtual environment.</p> | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ pip install | $ pip install awsebcli | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Confirm the installation with | Confirm the installation with `eb --version` | ||
Create an Elastic Beanstalk environment in the project directory: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ pip | $ pip install awsebcli | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Install Git == | === Install Git and PostgreSQL === | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Revision as of 13:07, 8 February 2016
Install Python
Check for python and pip, and their versions:
$ python --verison $ pip --version
Python 3.x
Python 3.x is often invoked as python3.
$ python3 --verison
If Python 3 is not installed:[1]
$ sudo yum list | grep python3 $ sudo yum install python34 # or relevant version
Create a virtual Python environment for the EC2 instance
Install virtualenv if needed:
$ which virtualenv $ pip install virtualenv
Create the virtual Python Environment[2]
$ virtualenv -p python3.4 /tmp/py34_nrose_env
Where py34_nrose_env is a name that makes sense for the app's virtual environment.
Start the virtual environment:
$ . /tmp/eb_python_app/bin/activate
Confirm the Python version:
$ python --version
Install Django [3]
(Make sure to use the virtual Python 3 environment.)
$ pip install django
Confirm the installation with
$ pip freeze | grep -i django Django==1.9.2
Install the Django project and its dependencies.
Install AWS Elastic Beanstalk CLI [4]
I couldn't get the following command to work until I switched to the Python 3.4 virtual environment.
$ pip install awsebcli
Confirm the installation with eb --version
Create an Elastic Beanstalk environment in the project directory:
$ pip install awsebcli
Install Git and PostgreSQL
$ sudo yum install git-all
Notes
See also
- Common Steps for Deploying Python Applications - AWS Elastic Beanstalk documentation
- Installing Python - AWS Elastic Beanstalk documentation
References
- ↑ How do I install python3 on an AWS instace (Stackoverflow)
- ↑ Setting up a virtual Python environment (AWS documentation)
- ↑ Install Django (Deploying a Django Application - AWS Elastic Beanstalk)
- ↑ Installing the AWS Elastic Beanstalk CLI (AWS documentation)