Forums

access issue to static file

Hi,

I want users to be able to see and read my JSON file at

[https://www.pythonanywhere.com/user/FHIRsIRBtesting/files/home/FHIRsIRBtesting/mysite/static/Consent.questionnaire.responses.2019.10.08sample.json]

but they are being prompted for a password.

I have checked the permissions in bash for this file and "Other" has "r" so that is good.

I have checked at the Web Console to be sure that Password protection is disabled.

I think that my static file setup is correct, because when I input my password, they can see the json file.

I don't understand why they are being prompted for a password. Please help.

Also, if you want to log into my console or dashboard to look at my files, that is acceptable to me.

How do you serve those files? If you use the url you pasted above it won't work as it requires your account to be logged in in the browser. You should serve it using static file mapping. see https://help.pythonanywhere.com/pages/StaticFiles

I thought that my URL was using the static file mapping. I don't want the Consent.questionnaire.responses.2019.10.08sample.json served through my Flask app. I want it hosted through your web server. I have set up the static file mapping, but maybe I did something wrong? Can you give me a hint of which settings to change?

Right now you have a static file mapping from /static to /home/FHIRsIRBtesting/mysite. This means that a request to http://FHIRsIRBtesting.pythonanywhere.com/static/something.json will make the web server serve up a file from /home/FHIRsIRBtesting/mysite/something.json, which is probably not what you want because if you have private data in the directory /home/FHIRsIRBtesting/mysite/, it will be exposed to anyone who can guess the filename. It also means that if there is no file of that name there, the request will be passed on to your Flask code, which will probably return a 404.

I suspect what you wanted to set up was a static file mapping from /static to /home/FHIRsIRBtesting/mysite/static