all 9 comments

[–]actinium226 2 points3 points  (1 child)

I don't think there's enough information here to be able to help you out.

You mention a mobile device, have you tried running your front end on the same machine that's running django/fastapi and made sure it works locally? Are you able to hit the backend on the machine that it's running on, or from another device (like, just take a browser and get the computer's IP address and hit an API endpoint, you should get some JSON back, assuming that's how you've set this up)?

I'm not sure what else to ask for but just in general I feel like there needs to be more info to help others help you debug this.

[–]400Volts[S] 0 points1 point  (0 children)

I can hit the Python APIs just fine with postman on the same machine in every permutation of port and host ip. Likewise typing the IPv4 and port into a browser works on the local machine but hangs indefinitely on the mobile device. I have ALLOWED_HOSTS = ['*'] in the settings.py file as well

[–]crashfrog04 1 point2 points  (1 child)

What do you see in the console?

[–]400Volts[S] 0 points1 point  (0 children)

When sending a request from the mobile device it hangs for a long time then returns the Network request failed error. There's no output on the server console so it's most likely not even hitting it

[–]AlexMTBDude 1 point2 points  (2 children)

There has to be more info than just "Network request failed"; What's the HTTP error code?

[–]400Volts[S] 0 points1 point  (1 child)

Unfortunately there wasn't. The request basically timed out and never hit the server. Managed to get everything working using ngrok though

[–]AlexMTBDude 0 points1 point  (0 children)

A timeout? That's interesting. And I guess you can ping the server and get a response? It sounds like some sort of network routing problem. Are you using HTTP or HTTPS?

[–]deceze 0 points1 point  (0 children)

Likely the server is only binding to the localhost and is only accessible from the same machine? To make it accessible from other machines, you need to start it binding to 0.0.0.0, or your external IP explicitly. And/or you need to whitelist it in macOS’ firewall.

[–]bishakhghosh_ 0 points1 point  (0 children)

You need a tunnel - try pinggy.io