'What is the difference in localhost:8000 and http://127.0.0.1:8000?
I am running a Django project with react redux (trying to implement authentication system) and the very weird thing i observed that my site is rendering properly when i use localhost:8000
or http://127.0.0.1:8000
.
But when i m trying to login/signup (ie trying to send post request) then it working only when i use localhost:8000
, and giving some error when using http://127.0.0.1:8000
.
One of the error when using http://127.0.0.1:8000
is shown below.
However i have seen this and found localhost will often resolve to ::1, the IPv6 loopback address. But i am getting is it related to this or not ?
And whether localhost:8000
and http://127.0.0.1:8000
is same or not ?
Please try to answer in simple words because I have not much knowledge of internet protocol or networking.
Solution 1:[1]
This problem is because of CORS. You have to enable from outside your application.
This happens because django apps and generally all frameworks blocks requests outside your address.
You can read more about CORS here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | carlosza |