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 retu
I had the same problem and here was my way to solve it:
First, You must know your IP address. On my Windows PC, in the cmd windows i run ipconfig and select my IP V4 address. In my case 192.168.0.13
Second as mention above: runserver 192.168.0.13:8000
It worked for me. The error i did to get the message was the use of the gateway address not my PC address.
For people who are using CentOS7, In order to allow access to port 8000, you need to modify firewall rules in a new SSH connection:
sudo firewall-cmd --zone=public --permanent --add-port=8000/tcp
sudo firewall-cmd --reload
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
I was struggling with the same problem and found one solution. I guess it can help you. when you run python manage.py runserver, it will take 127.0.0.1 as default ip address and 8000. 127.0.0.0 is the same as localhost which can be accessed locally. to access it from cross origin you need to run it on your system ip or 0.0.0.0. 0.0.0.0 can be accessed from any origin in the network. for port number, you need to set inbound and outbound policy of your system if you want to use your own port number not the default one.
To do this you need to run server with command python manage.py runserver 0.0.0.0:<your port>
as mentioned above
or, set a default ip and port in your python environment. For this see my answer on django change default runserver port
Enjoy coding .....
Just in case any Windows users are having trouble, I thought I'd add my own experience. When running python manage.py runserver 0.0.0.0:8000
, I could view urls using localhost:8000
, but not my ip address 192.168.1.3:8000
.
I ended up disabling ipv6 on my wireless adapter, and running ipconfig /renew
. After this everything worked as expected.
First, change your directory:
cd your_project name
Then run:
python manage.py runserver