I have a django REST project which is locally running on my laptop. I am developing an android app to use an api provided by this django project. Both my laptop and android device are connected to the same wifi network. I am using android volly library to access the api. What i have tried is
From terminal run ifconfig
ang got inet addr
. Let it be 192.168.1.8.
Inside android volly used the url "http://192.168.1.8:8000/api_part/". (The project is running on port 8000)
Then the response i am getting from volly is
com.android.volley.NoConnectionError: java.net.ConnectException: failed to connect to /192.168.1.8 (port 8000) after 2500ms: isConnected failed: ECONNREFUSED (Connection refused)
Am i using a wrong url to access the api? If not then how to acess this locally running project from android app?
Make sure you start the run server with the correct IP or bind it on all IPs:
$ python manage.py 0.0.0.0:8000