Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to EC2 Django development Server

I am new to EC2 and web development. Currently I have a Linux EC2 instance running, and have installed Django. I am creating a test project before I start on my real project and tried running a Django test server.

This is my output in the shell:

python manage.py runserver ec2-###-##-##-##.compute-1.amazonaws.com:8000 Validating models...  0 errors found Django version 1.3, using settings 'testsite.settings' Development server is running at http://ec2-###-##-##-##.compute-1.amazonaws.com:8000/ Quit the server with CONTROL-C. 

To test that it is wroking I have tried visiting: ec2-###-##-##-##.compute-1.amazonaws.com:8000 but I always get a "Cannot connect" message from my browser.

Whenever I do this lcoally on my computer however I do successfully get to the DJango development home page at 127.0.0.1:8000. Could someone help me figure out what I am doing wrong / might be missing when I am doing this on my EC2 instance as opposed to my own laptop?

like image 376
Mars J Avatar asked Mar 26 '12 01:03

Mars J


People also ask

How do I connect to an EC2 Web instance?

Sign in to the Amazon VPC console. On the navigation pane, in the Virtual Private Cloud section, choose Internet Gateways. In the search box, search for the internet gateway attached to your VPC. You can also use the search bar on the page to search for your Attached VPC ID (for example, vpc-xxxxxxxx).


1 Answers

Using an ec-2 instance with Ubuntu, I found that specifying 0.0.0.0:8000 worked:

$python manage.py runserver 0.0.0.0:8000   

Of course 8000 does need to be opened for TCP in your security group settings.

like image 93
eezis Avatar answered Oct 05 '22 13:10

eezis