0

I really try not to ask questions on here, but I've been googling for a bit now and can't find the answer or another method to try. I have a CentOS box at my house hooked to a router. I've assigned it a static IP of 192.168.1.140. Because I'm lazy, I just ssh into it. When I'm goofing around with Django (learning Django/Python at the moment) and I run python manage.py runserver with a variety of IP address, I can't get my browser to access that box. I've tried

python manage.py runserver 0.0.0.0:8000
python manage.py runserver 8000
python manage.py runserver localhost:8000
python manage.py runserver 192.168.1.140:8000
python manage.py runserver 192.168.1.255:8000
python manage.py runserver 192.168.1.0:8000
python manage.py runserver 192.168.1.1:8000 #this errors out and says I can't use this IP address although this is the IP I use to access the router

When I run netstat -tln in another terminal I can indeed verify that it's listening on port 8000 to the specified address. In iptables I've run it just how it is and I've run it through tcp --dport 8000 and --sport 8000 with the same results. Just can't quite seem to crack the code. I've also setup port forwarding on my router so port 8000 is directed at 140. Is there a log somewhere I can check that I can't find on google? What am I missing?

Whilst googling I came close to an answer but I think it must be something else.

I'm running Python 2.7.5 and Django 1.5.2 through virtualenv if you need to know. Is virtualenv my issue? Thanks y'all

n0nag0n
  • 1,575
  • 1
  • 17
  • 25
  • The first one is correct. But where is the browser you are accessing it from? On the same network as the server? And what address are you using in your browser? – Daniel Roseman Aug 27 '13 at 09:20
  • @DanielRoseman My computer I use my browser on is on the same network as well. I point it to 192.168.1.140:8000 and it just times out. I know it does work because I have apache running on that box as well and when I just go to the IP, apache catches it just fine......I didn't even think of this but do I need to shut off apache in order for the dev server to work? I didn't think it did since they are different ports... – n0nag0n Aug 27 '13 at 15:17
  • Possible duplicate of [making django server accessible in LAN](http://stackoverflow.com/questions/22144189/making-django-server-accessible-in-lan) – Tony Nov 04 '15 at 22:04
  • Whoa man, @Tony my question clearly came before that question. That question is a duplicate of mine ;) – n0nag0n Nov 05 '15 at 14:52
  • @ImmortalFirefly - My bad. Vote retracted. – Tony Nov 05 '15 at 21:57

1 Answers1

1

According to this documentation, the right approach would be to set the python manage.py runserver xxx.xxx.xxx.xxx:yyyy to the IP address of the port you're using [Wi-Fi or Ethernet]. If the other devices are connected to the same LAN, then they should be able to access your Python VirtualEnv straight from their browsers. Worked just fine on mine. Also, I use DHCP - don't know if it changes anything. Just thought I'd mention that.

Migisha
  • 415
  • 4
  • 10
  • ha, it's been so long I no longer have this setup to test anymore. But +1 for the effort – n0nag0n Oct 24 '14 at 13:29
  • haha alright then, @ImmortalFirefly. Hopefully someone having the same issue in the future will pick from here :) – Migisha Oct 25 '14 at 04:55