Forums

static folder inconsistency

I have a site that has been running for around 6 months with the code virtually untouched during that time. I updated some of the code yesterday and I'm hitting an issue with an unrelated piece of code which is now failing. I'm using flask. My static folder is directly off the root folder where the app is running (/home/DeciNoFrac/launchreport) and I've been successfully accessing a json file using the code below:

loc_json = open("static/src/locations.json", "r")

This is now failing when I update the flask application code, so I've rolled back. However, I notice that on the web tab for some reason I've mapped "static" to /home/DeciNoFrac/static, however the folder where the static json file is hosted is actually in /home/DeciNoFrac/launchreport/static. I'm a little confused as if the mapping is incorrect then why isn't the existing code failing? As for resolving it I'm concerned about changing the static mapping as my current app may fail. If it does fail I'm unsure whether rolling the mapping back will get it back to where it is now.

Note that the same static path to images resolve in the flask templates, I think with the old and the new code.

I don't have any other references in my code such as url_for, etc... Any help much appreciated.

The code wouldn't fail if your static files directories are misconfigured, it's just that files that were supposed to be served by that mapping would not be published

Thanks for the reply Glenn.

I'm not sure I understand. I have reloaded the website/flask instance with an incorrect mapping and it's not failing despite the code having the same reference. Can you clarify what you mean by published please.

I think I'll take the following approach:

Update the mapping to static on the web tab.

Reload the current app.

If that works, I'll test backing out the mappings and reload the current app again.

If that goes to plan then I'll update the static mapping again and proceed to deploy the updated code.

If it fails at that point I'll roll everything back.

Is it possible for you to snapshot/backup my container before I do this please? We could co-ordinate over email if that's easier.

We cannot take snapshots for your experiments

OK, so it looks like I need to do this at risk.

I'll need to build a holding page first though and temporarily remove some of the navigation links to the pages that cause the error :-(

So the good news is that I changed the static mapping in the web configuration and the existing code continued to work as expected.

Even better news is that the new code deployed fine - happy days!

Glad to hear that!