After following this tutorial to setup an EC2 instance for a Django app, I can’t connect to the application. Any help debugging, would be greatly appreciated.
Steps followed after setting up EC2 instance:
- sudo aptitude install python-django
- sudo aptitude install mysql-server
- sudo aptitude install python-mysqldb
- sudo aptitude install libapache2-mod-wsgi
- mkdir srv
- cd srv
- django-admin startproject mysite
-
sudo vim /etc/apache2/sites-available/mysite.com
NameVirtualHost *:80 <VirtualHost *:80> ServerName mysite.com ServerAlias www.mysite.com WSGIScriptAlias / /home/demo/public_html/mysite.com/mysite.wsgi </VirtualHost> -
sudo vim /home/demo/public_html/mysite.com/mysite.wsgi
import os import sys sys.path.append('/home/demo/public_html/mysite.com/') os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() -
sudo a2ensite mysite.com
- sudo /etc/init.d/apache2 reload
For my host records on my URL:
@ to the Private IP from Amazon as an A Record
www to the Private IP from Amazon as an A record
The result is that when I enter the IP address, myurl.com, and http://www.myurl.com all are unable to connect to the server.
Any ideas on how to debug this?
Don’t use the private IP for your instance, that’s only useful if you’re accessing your instance from within EC2, instead use the public IP in your hosts file.