Forums

Make file available online to GET requests

Hello, I have a .py file writing data into a json file. The thing is, when I put the file in /mysite, I get a 404 if I try to access it with the browser. If I put the file into /home/myusername, and I set the file in the static file option, I can access it with my browser but not with a GET request (still returning 404).

How can make the file accessible from myusername.pythonanywhere.com/myfile.json with a GET request? And also, how can I set up http headers in the same directory?

I use flask (because I have little to no knowledge of hosting python apps online) but I don't mind installing something else if needed.

Thank you for your help!

Hmm, when you access the file via a browser then the browser will be making a GET request under the hood. So if it's working in the browser but not elsewhere, then the problem must be something else. How are you making the GET request? Could you share the URL, perhaps? (You can share it privately via the "Send feedback" link at the top right.)