Last active
August 12, 2019 15:58
-
-
Save eezis/4026247 to your computer and use it in GitHub Desktop.
Django on Amazon EC2 using Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALSO SEE THIS: http://eddychan.com/post/18484749431/minimum-viable-ops-deploying-your-first-django-app-to | |
AND THIS: http://bitnami.com/stack/django | |
These are my notes on how to quickly setup a python, virtualenv (use virtualenv-burrito FTW), and django. | |
Setup an EC-2 instance: | |
======================= | |
Use the quick launch wizard: | |
1. Name the instance | |
2. Select an existing SSH key (or if you need to, make a new one) | |
3. Select OS (Ubuntu Server 12.10 64 bit) | |
CONTINUE -- then EDIT DETAILS | |
4. Under Security Settings select Django | |
5. Save Details | |
6. Launch | |
SSH Connection to the instance: | |
=============================== | |
1. Open Terminal Window | |
2. cd .ssh (or cd ~/.ssh if you are not in the home dir) | |
3. Connect: | |
username is not ec2user@address but ***ubuntu*** . . . ubuntu@address | |
.ssh $ ssh -i yourkeyfile.pem [email protected] | |
Setup the Django Python Environment: | |
==================================== | |
0. sudo apt-get update; sudo apt-get upgrade | |
1. $sudo apt-get install yum | |
2. $python -V [in order to confirm you have the right version of Python] | |
3. $sudo apt-get install python-setuptools (this gets easy_install) | |
4. $sudo easy_install pip [*** note, it is underline not hyphen!] | |
5. $sudo apt-get install git | |
6. now install virtualenv burrito with this command: | |
curl -s https://raw.github.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh | $SHELL | |
7. per instruction, $ source /home/ubuntu/.venvburrito/startup.sh | |
8. $mkvirtualenv <name> | |
9. pip install django | |
If you wish you can django-admin startproject <projname>, launch a server [use 0.0.0.0!, as in $python manage.py runserver 0.0.0.0:8000] and then launch a browser http://ec2-youraddress.compute-1.amazonaws.com:8000/ to test the install. If you have opened up HTTP access to that port it should work. If not, open a second ssh window, start a telnet session and try to telnet to port 8000: $ telnet localhost 8000, then type "GET /" and ***hit enter a couple of times*** [important to hit enter twice]. If you can't connect then runserver isn't working properly, if you can connect and you get HTML from the GET then the problem is between you and the server (you probably don't have the ports open in the security profile you have associated with the EC2 instance). | |
If you have a project ready to go, cd into the directory that should house it (e.g. \sites) and then: | |
$ sudo git clone https://github.com/gituser/theproject.git | |
IF Django_local_flavor needs to be installed: | |
pip install https://github.com/django/django-localflavor-us/zipball/master | |
Tags: Setup Install Django Amazon AWS Ubuntu Server Python Virtualenv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can i use this tutorial as at may 2016?