So I did a research before posting this and the solutions I found didn't work, more precisely:
-Connecting to my laptop's IPv4 192.168.XXX.XXX- didnt work
-Conecting to 10.0.2.2 (plus the port) - didnt work
I need to test an API i built using Django Rest framework so I can get the json it returns, but i cant access through an Android app i'm building (im testing with a real device, not an emulator). Internet permissions are set on Manifest and i can access remote websites normally. Just can't reach my laptop's localhost(they are in the same network)
I'm pretty new to Android and Python and Django as well (used to built Django's Rest Framework API).
EDIT: I use localhost:8000/snippets.json or smth like this to connect on my laptop.
PS: I read something about XAMP server... do I need it in this case?
Thanks in advance
Have you started the server like this?
Then, try to connect to 192.168.XXX.XXX:8000
I tried the above, but failed to work in my case. Then with running python manage.py runserver 0.0.0.0:8000 I also had to add my IP to ALLOWED_HOSTS in settings.py, which solved this issue.
eg. Add your ip to allowed hosts in settings.py ALLOWED_HOSTS = ['192.168.XXX.XXX']
Then run the server python manage.py runserver 0.0.0.0:8000