I am running python manage.py runserver
from a machine A
when I am trying to check in machine B
. The url I typed is http://A:8000/
.
I am getting an error like The system returned: (111) Connection refused
1) python manage.py runserver This command you'll probably run the most of all commands. It means to run a emulated server on your local computer. So, after running it, you can go to localhost:8000 or 127.0. 0.1:8000.
Inside the commands folder open up the runserver.py script with a text editor. Find the DEFAULT_PORT field. it is equal to 8000 by default. Change it to whatever you like DEFAULT_PORT = "8080"
You can run it for machines in your network by
./manage.py runserver 0.0.0.0:8000
And than you will be able to reach you server from any machine in your network. Just type on other machine in browser http://192.168.0.1:8000
where 192.168.0.1
is IP of you server... and it ready to go....
or in you case:
A
in command line ./manage.py runserver 0.0.0.0:8000
B
in browser type http://A:8000
Source from django docs
You need to tell manage.py the local ip address and the port to bind to. Something like python manage.py runserver 192.168.23.12:8000
. Then use that same ip and port from the other machine. You can read more about it here in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With