NETWORK_ERROR apisauce

452 Views Asked by At

when i try to fetch data from my django server i got a NETWORK_ERROR

corsheader in backend is work

i just try localhost and my machine ip and notwork

this is the result of console.log(response.originalError)

Network Error at node_modules/apisauce/node_modules/axios/lib/core/createError.js:15:17 in createError at node_modules/apisauce/node_modules/axios/lib/adapters/xhr.js:96:22 in handleError at node_modules/react-native/Libraries/Network/XMLHttpRequest.js:609:10 in setReadyState at node_modules/react-native/Libraries/Network/XMLHttpRequest.js:396:6 in __didCompleteResponse at node_modules/react-native/Libraries/vendor/emitter/_EventEmitter.js:135:10 in EventEmitter#emit

1

There are 1 best solutions below

0
On

i just solve that problem

i just run my django backend with my machine ip and it's work and add it to setting.py file. ALLOWED_HOSTS = ['192.168.0.236']

python manage.py runserver [your machine ip]:8000

  1. run backend with your machine IP --> python manage.py runserver [your machine ip]:8000

2.add it to setting.py file. ALLOWED_HOSTS = ['your machine IP']