2

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

5
  • Why don't you run it in your local machine? Commented Feb 13, 2014 at 18:19
  • 3
    you have to access your AWS IP, not local IP Commented Feb 13, 2014 at 18:20
  • 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! Commented Feb 13, 2014 at 18:29
  • @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" Commented Feb 13, 2014 at 18:52
  • @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. :-/ Commented Feb 13, 2014 at 18:54

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

4 Comments

that is the key! ...I don't understand the port logic of a server and I'm sure the 8000 port access is the issue. I've learned that whatever i put in /var/www is accessible to the browser, but obviously i shouldn't be putting my python code into that folder...so I'm trying to figure out how to have it in another directory, but not get viewable in the browser, yet still run. I'll review the link you provided. thank you.
Why are you trying to run the development server on your instance? Generally speaking the dev server is used when developing on your machine and using your localhost. If you want to run the application on your server you could deploy it (I prefer Apache with Django but you could use nginx or whatever).
yes, I see what you mean, I was just trying to learn how to use my server, and their tutorial was specific to running via a server that i thought was supposed to be a remote server. Notably, I add 8000 to my custom TCP and UDP, and it still fails. Nvm though, i think you're correct that my initial approach is part of the problem.
Yeah I recommend looking into the deployment process. If you're new to Django it's part of the process of getting the app live. I haven't deployed via AWS (I use linode with Ubuntu) but I imagine if you are using Apache as your http server the process is fairly similar with setting up mod_wsgi in your apache conf
1

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.