Beginner question here. Its probably obvious to someone who does this stuff all the time. But I'm having difficulty setting up django running on an EC2 bitnami instance.
I setup my server and I'm able to log in. Just to test this I setup the polls example. Below are the commands I executed to get this running.
Questions:
- What am I doing wrong here?
- How do I get my basic polls page to show?
- Also, is there any best practices I should follow to configure a live server?
Any step-by-steps are greatly appreciated.
----commands-----
$ cd /opt/bitnami/projects/Project #directory already exists
$ sudo python manage.py startapp polls
$ sudo chown -R bitnami * # tired of doing sudo.. Good move or not?
$ vim polls/models.py # matches the example
$ vim polls/views.py #see below
$ vim urls.py # added: (r'^polls/$', 'polls.views.index'),
$ vim settings.py #added polls
$ python manage.py syncdb # tables created successfully
$ python manage.py runserver # server started
# Now I open my browser and go to: http://10.206.xxx.yyy:8000/polls/
# also tried ports 8080 and 80
# Error: unable to connect
-------views.py-----------
# Create your views here.
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the poll index.")
I also tried comments stated below without success.
Port 80
$ sudo python manage.py runserver 0.0.0.0:80
Django version 1.3, using settings 'Project.settings'
Development server is running at http://0.0.0.0:80/
Quit the server with CONTROL-C.
Error: That port is already in use.
Port 8000
$ python manage.py runserver 0.0.0.0:8000
#also tried python manage runserver 10.206.xxx.yyy:8000 (same results)
Django version 1.3, using settings 'Project.settings'
Development server is running at http://10.206.xxx.yyy:8000/
in browser: http://10.206.xxx.yyy:8000
result: Firefox can't establish a connection to the server at 10.206.xxx.yyy:8000.
in browser: http://10.206.xxx.yyy:8000/polls
result: same Firefox can't establish a connection
netstat
$ netstat -aon
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State Timer
tcp6 0 0 :::80 :::* LISTEN off (0.00/0/0)
# I don't know what this means exactly and why I can't see this server from the browser
Any ideas why its not working?