galacticpuzzlehunt / gph-site

Django app for running a puzzlehunt (open-source version)
MIT License
65 stars 33 forks source link

fix gettest error #28

Closed enigmathix closed 2 years ago

enigmathix commented 2 years ago

As it turns out, even if it looks redundant, the explicit path to jsi18n is necessary in the list of urls, otherwise the frontend get a javascript error about not finding gettext(). (for info this line was removed during the pull request review).

cesium12 commented 2 years ago

Hm, interesting. Do you know under what circumstances this error happens? I didn't see anything broken when I tried out the site with your previous changes. Also, I don't see why the two paths would behave differently, as they seem like they should be the same except that one has caching. I'd like to be sure this is the right fix, and ideally also understand what the root cause is.

(If this does turn out to be necessary, please add a comment explaining that, so it doesn't get accidentally removed again in the future.)

enigmathix commented 2 years ago

You can see the problem on the home page of a puzzle hunt: hover over the start/end time of the hunt and there's a javascript to show them to you in your local time. That's no longer working. I don't have an explanation of why it's allowed to have 2 entries for the same url, but both make a difference: one makes it work, the other caches the javascript in the browser (you can see that in the developer tools). I got this from the doc, but I don't know why it has to be that way. I read on stack overflow that the order matters, and the /js18 url should be put at the top of the list, but that didn't fix the problem for me.

cesium12 commented 2 years ago

Yeah, I'm saying I can run the server without this PR and everything is fine; js18n is loaded correctly and the hover works as well. I'm sorry to block this but I want to dig further into why this is happening for you later today -- maybe it's somehow dependent on the Django version, or only appears when running in a non-English language?

enigmathix commented 2 years ago

I'm building a US hunt site and that's how I noticed it.

cesium12 commented 2 years ago

It's still working for me, no matter what I try.

Documentation here and here only show one entry in urls. Can you link the doc page and stack overflow page you mentioned earlier?

Is it possible your Django cache is misconfigured? If you go to http://lemm.as:8000/, does it work for you?

enigmathix commented 2 years ago

Your site works for me. Mine runs on heroku, maybe that's where the difference comes from?

cesium12 commented 2 years ago

That seems plausible. There might be some configuration you can do outside gph-site to fix it.

If you decide that this is the best or only way to get it to work on your setup, that it'll be useful for other hunts, and that it won't break anything, then add a bit more explanation of the specific problem to the comment and I'll merge it. Otherwise, nothing wrong with keeping it in your own fork of gph-site.