Here are the steps to setup Django on Amazon EC2 server:
The image is ubuntu-maverick-10.10-amd64-server-20101225
Choose the ebs one, otherwise you will lose everything after you shutdown your server
- sudo apt-get update
- sudo apt-get install apache2
- wget http://www.djangoproject.com/download/1.3/tarball/
- mv index.html Django-1.3.tar.gz
- tar xzvf Django-1.3.tar.gz
- cd Django-1.3
- sudo python setup.py install
- sudo apt-get install libapache2-mod-wsgi
- create "/home/ubuntu/mysite/django-server.wsgi"
- sudo /etc/init.d/apache2 start
- cd /etc/apache2/sites-available
- sudo cp default mysite
- edit "mysite"
- a2ensite mysite
- sudo /etc/init.d/apache2 reload
- sudo /etc/init.d/apache2 restart
- cd ~
- django-admin startproject mysite
- cd ~/mysite
- django-admin startapp myapp
- python manage.py runserver 0.0.0.0:8000
import os, sys
sys.path.append('/home/ubuntu/')
sys.path.append('/home/ubuntu/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Listen 8000
<VirtualHost *:8000>
WSGIScriptAlias / /home/ubuntu/mysite/django-server.wsgi
WSGIDaemonProcess server1piece user=www-data group=www-data processes=1 threads=10
ServerAdmin webmaster@localhost
DocumentRoot /home/ubuntu/
Alias /static/admin/ /home/ubuntu/Django-1.3/django/contrib/admin/media/
0 comments:
Post a Comment