I’m running an EC2 instance on AWS. I’m running apache out of the standard port 80 without issues, and I have an node.js/Express application running out of port 3000 without issue. I’m trying to open up port 8000 on the machine and I’m not able to connect. I’m attempting to run a Django project from 8000. Locally, on my machine, I’m able to run the Django project. When I use the curl command locally, I get data back:
curl localhost:8000
That returns a valid HTML page. When I use the netstat command, it shows that port 8000 is being listened to. If I open a new window and attempt to start Django again when the first one is running, I get an error that port 8000 is already in use. So, it looks like things are running properly on the local machine.
So that leads me to believe that there is something incorrect with my AWS set up. However, I set up the ports the same way for 8000 as I did for 3000. Here is a screen shot of the Inbound rules:
I did set up port 3000 over 2 years ago, so it’s possible I’m missing a step, but everything looks right from what I can remember.
2
Answers
Thanks for all the help. I needed to make two changes:
If you set
DEBUG = True
andALLOWED_HOSTS = []
insettings.py
, the host is validated against the list['.localhost', '127.0.0.1', '[::1]']
which your EC2 deployment does not meet.Also note, that you should not use the above settings in production.