2
votes

I'm learning to use Django. I'm following their first tutorial at: https://docs.djangoproject.com/en/1.6/intro/tutorial01/

I'm running everything on an AWS server i made with the directory structure below.

I tried running their code to make a simple code deployment to a browser: python manage.py runserver

 it runs without error,but when i go to http://127.0.0.1:8000/  chrome throws error "Oops!      Google Chrome could not connect to 127.0.0.1:8000"

I know i'm misunderstanding the structure of a remove server. If someone could enlighten me on how to get this working i would appreciate it.

thank you


(my directory structure)

/home/PythonFiles# ls -R .: mysite

./mysite: manage.py mysite

./mysite/mysite: init.py init.pyc settings.py settings.pyc urls.py wsgi.py wsgi.pyc

2
Why don't you run it in your local machine? - Daniel Roseman
you have to access your AWS IP, not local IP - Jason
Get the IP of the AWS server and try typing that one in :) AWS might require some other configuration to be outward facing, I'm not too sure! - Weaver
@Daniel yea i can run it on my local machine no problem, but i want to learn to do it on the server and, obviously, run into a bunch of "learning moments" - nerdlyfe
@Weaver yes, i tried that, and still errored, so I think you're right about the accessibility. everything is accessible from /var/www, but of course, i'm told it's bad practice to expose your code to the web, so I'm trying to understand how to get code not in /var/www to run, without be accessible by user. :-/ - nerdlyfe

2 Answers

1
votes

You can check out the answers on this post: Connecting to EC2 Django development Server

Make sure the port 8000 is open via your firewall settings

1
votes

You need the ip address of the AWS server, then use

python manage.py runserver aws.ip.address:8000

And make sure 8000 is open to public access.