Forums

Confused by paths on embeds

Had some weirdness this morning where /templates folder seemingly disappeared from mysite in Flask installation.

I now have a page https://elksie5000.pythonanywhere.com/

However, I can't seem to point files which are in the new /templates directory for the embeds in that index.html to load.

Can anyone help?

Okay, I'm seriously confused. One embed now loads but others don't. The page is caching like mad. How do I break the cache?

Could you clarify what you mean by "embeds"? Are you dynamically changing your templates from your Flask code? If so, that won't work -- Flask always caches templates.

Sorry. I meant iframes. I've struggled a little with making the src attribute point to the right file path.

Sorry. I meant iframes. I've struggled a little with making the src attribute point to the right file path.

Sorry. I meant iframes. I've struggled a little with making the src attribute point to the right file path.

Sorry. I meant iframes. I've struggled a little with making the src attribute point to the right file path.

The best way to sort that out is to try visiting the URL that you plan to embed first, and then to copy the URL from the browser location bar to the src attribute on the iframe.

Okay, I've found the link - https://www.pythonanywhere.com/user/elksie5000/files/home/elksie5000/mysite/templates/war_dead_panels.html but when when I try to open https://elksie5000.pythonanywhere.com/ where the iframe is, still not found.

When I use the inspector in Chrome it shows another path yet it looks right within pythonanywhere.

Check the src value where the url for war_dead_panels is, as it looks like there's a typo (instead of "/", there's a "." rendered -- when I edited it using dev tools in the browser, it showed up on the page).

@pafk, that's true. But the page remains cached with that typo even though I've updated the page. And I don't know how to refresh the page.

Change the file, reload your web app and then reload the page while holding shift.