Forums

static path resolution

I'm trying to run a static website generated with nikola on PA. It is working correctly on localhost and when the static pages are pushed directly to a linux cloud host (no Python involved). It is generally working on PA, except that my Bootstrap4 navbar is going to the wrong location on non-top level addresses. Though I've verified the generated code and the current page location at the time of reference, it is removing one level of the path. I've tried to verify that I have the correct code and page.

This is clearly some error in my understanding of how the browser computes a page refernce, but I'm really at a loss as it looks to me like the browser is simply deriving the wrong reference. I don't even see why PA static handling is involved at this point.

Any pointers would be greatly appreciated.

Thanks, --Don

The navbar reference in the browser is: enter image description here

The function vrfy that is invoked is: enter image description here

The location at the time of the onclick is: enter image description here

The resolved page is (missing "activities-index"): enter image description here

And the same resolution when run locally is: enter image description here

And my static file setup is: enter image description here

Hi, looks like you're missing slash at the end of your initial url so activities-index is interpreted as current directory and ../index.html goes one up, so to /pages/. I'd suggest looking to how urls are being resolved for the pages.

Thank you - that is causing the problem. Now I need to find the fix! Appreciate the help. --Don

Glad we could help and -- fingers crossed for finding the fix!

Tried to share this forum post to the developers at Nikola and tripped over the fact that you apparently have to be logged in to PA in order to see the images. :-(

Still haven't figured out what is going on, but it does bother me that the same site works when running on Ionos (1&1) statically.

(this is not a request for help - just a note on seeing forum posts as a non-PA user)

Ah thanks for reporting! The pictures you are using are only visible to you yourself and to forum admins. That is intended for security-- otherwise anyone could see your files.

I hate to keep bringing this to you, but I'm really struggling. I've run a number of tests including:(1) generating on my localhost using PA configs, (2) comparing Python versions (I run 3.85 locally) and checking for differences, (3) checking relevant venv packages [esp. URLlib], and(4) moving the actual pages from PA to another cloud. In all cases, things work except on PA. In particular, test (4) involves no running Python and uses the same generated pages.

Am I correct that the url of the current page is actually determined by the web server - not my code? If so, what config settings could affect behavior? The browser's href is correct - it's the page's url that is missing the trailing '/' (the page is an index.html in the specified folder).

I'd really appreciate some pointers to be able to find/determine exactly how the current url is determined. I'd really hate to have to find another cloud provider, but this is getting a bit discouraging. --Don

Take a look at https://help.pythonanywhere.com/pages/DebuggingStaticFiles/