0

I am working on a centOS7 server, I created a project and used python manage.py runserver command. From a browser on my local machine, I cannot access the localhost:8000 address.

I tried precising the address like python manage.py runserver 0.0.0.0:8000

Added also '*' to the ALLOWED HOSTS in settings.py

Nothing worked. I still can't access from the browser.

YOUR HELP WOULD BE MUCH APPRECIATED. Thanks.

Geek2.0
  • 3
  • 2
  • Have you tried to access it within the server? If you can, then it is pretty much a networking issue. Check the firewall/router settings in your local network. – Orix Au Yeung Jul 09 '23 at 19:04
  • How can I try to access it within the server since there is no browser? Sorry to ask, but I'm not familiar with centOS. – Geek2.0 Jul 09 '23 at 19:15
  • Afaik `curl` is pre-installed in CentOS 7. You can run `curl http://localhost:8000` to see if you can get a valid response. – Orix Au Yeung Jul 09 '23 at 19:21
  • The output of that command seems to be the source code of the page – Geek2.0 Jul 09 '23 at 19:52
  • So yes, this means the Django server is up. There seems to be something between your server and client preventing them to talk with each other. – Orix Au Yeung Jul 09 '23 at 22:05
  • I added the machine's IP address in the firewall whitelist IPs of the server. And added '*' in **ALLOWED_HOSTS** BUT STILL NO ACCESS Any other idea? – Geek2.0 Jul 10 '23 at 10:43
  • Note that I can ping from my machine to the server's address but cannot ping from server to the machine – Geek2.0 Jul 10 '23 at 10:46

1 Answers1

0

If anyone experiences the same issue, the solution was to open port 8000 on server's firewall.

Now I can access the server's address from my system.

Geek2.0
  • 3
  • 2