Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
leaf-node opened this issue Aug 19, 2019 · 4 comments
Open

Comments

@leaf-node
Copy link

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
Copy link
Member

drnlm commented Aug 19, 2019

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?

@leaf-node
Copy link
Author

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 : )

@leaf-node
Copy link
Author

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.

@hodgestar
Copy link
Member

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants