blog 2 dsdssd - uu

#dfdd cxz String

\n\nRecently I was building a flutter app and was using Django to build its backend. I wanted to call by APIs from my app which was running on my phone after searching the net I finally found the way!!.\n\n### Step 1\n\nFirst, we need to make sure that our computer and phone are connected to the same Wifi (or you can connect your computer to your mobile HotSpot)\n\n### Step 2\n\nFind the IP address of your Desktop\n\nFor Type in ComandLine Windows\n\nbash\nipconfig\n\n\nFor Linux/mac Type in terminal\n\nbash\nifconfig\n\n\nThe command shall show your IP Address (Example = 192.168.20.22)\n\n### Step 3\n\nNormally when we run our Django server using\n\npython\npython manage.py runserver\n\n\nIt runs on localHost( 127.0.0.1) which we cannot access from another device so we run our server on our computers IP Address in Django we do that by-\n\npython\npython manage.py runserver 0.0.0.0:8000\n\n\nThis command will run our server on our computer so that other devices on the same network can also access the server. Also, don’t forget to add your IP address in the ALLOWED_HOSTS in the setting.py file of your Django project.\n\n### Step 4\n\nNow open any browser and open YOUR_IP:8000/api_endpoint\n\nexample:= 192.168.20.22/my_site and you will be able to see the expected result\n\n### Conclusion\n\nThe Above example is for Django but could be done on any other framework all you have to do is figure out how to run your server on xz machine IP address and connect to the same network. You can use the URL with the IP address and call from any application you are building

Did you find this article valuable?

Support Mukund Tandon by becoming a sponsor. Any amount is appreciated!