CTPUG/wafer

Wafer creates 301 redirects to filename.css/ (creating a trailing slash)

Opened this issue · 4 comments

I'm using Wafer version fb55e75. All files under /static/ are redirected by wafer to file names with a trailing slash, that then they produce 404s. This is what the server log says:

...
[19/Aug/2019 20:49:44] "GET /static/vendor/popper.js/dist/umd/popper.min.js HTTP/1.1" 301 0
[19/Aug/2019 20:49:44] "GET /static/vendor/popper.js/dist/umd/popper.min.js/ HTTP/1.1" 404 2589
...

Thanks! : )

drnlm commented

I haven't seen that behaviour on any of our deployments. Could you provide a bit more detail about your setup, such as Django and python version you're using and so forth?

Adding DEBUG = True to the settings.py file seemed to resolve the issue. However this one file still has issues:

[19/Aug/2019 21:28:49] "GET /favicon.ico HTTP/1.1" 301 0
[19/Aug/2019 21:28:50] "GET /favicon.ico/ HTTP/1.1" 404 1692

Thanks to the helpful people on #wafer : )

So that does the following (in wafer/urls.py):
# Serve media
if settings.DEBUG:
urlpatterns += static(
settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Possibly this can be considered essentially misconfiguration rather than a bug, but > we should at least document it in setup.
@bokchoy What was happening was that it wasn't finding your static files at all, and then wafer was trying to append a trailing / as a fallback.

Please let me know if you want more information now that this much is clear.

What was happening was that it wasn't finding the static files at all, and then wafer was trying to append a trailing / as a fallback.

I think what wafer's code is doing is fine, but we need to update the developer install documentation to mention adding a settings.py file with DEBUG = True set in it, and the production documentation to mention running collectstatic (and configuring settings, installing npm and having something like nginx to serve the static pages -- all so that that works).