Comments (7)
Hi, I believe I've encountered a bug or not followed the instructions correctly. Most likely, the latter. But my issue is that after following the instructions for configuring Cloudfront with whitenoise, CF cannot access any files under my static folder.
Error: The requested resource was not found on this server.
This is too little information to go on. What are the requests you're making and how are they failing?
Have you tried accessing your app not through the CDN?
Also, the instructions have us create
staticfiles
andstatic
directories, is that supposed to be the case when using a CDN? Or wasstaticfiles
only for setup without a CDN? Should these two directories be consolidated?
You need the directories whether or not you are using a CDN.
from whitenoise.
Hi, I believe I've encountered a bug or not followed the instructions correctly. Most likely, the latter. But my issue is that after following the instructions for configuring Cloudfront with whitenoise, CF cannot access any files under my static folder.
Error: The requested resource was not found on this server.This is too little information to go on. What are the requests you're making and how are they failing?
All requests to static files fail with a 404 error Not Found: The requested resource was not found on this server.
This includes my css, js, and static image files. When loading a page, the necessary static resources fail with that error. The same error also occurs when accessing the files directly from the CDN.
Initially, I began with: "whitenoise.storage.CompressedManifestStaticFilesStorage"
- which didn't work at all. It caused a server error. So I then switched to "whitenoise.storage.CompressedStaticFilesStorage"
and now pages will load but without any of my static content.
So I wonder if there's some cache issue going on? Essentially my CDN can load everything on my site except the files being handled by whitenoise.storage
.
Have you tried accessing your app not through the CDN?
Serving the files locally in debug works if I run python manage.py runserver --nostatic
but standard python manage.py runserver
leads to the same 404s on static files.
from whitenoise.
Are you using {% static %}
to generate your static URL’s? What do they look like?
from whitenoise.
Are you using
{% static %}
to generate your static URL’s? What do they look like?
Yes, here are a few of them:
<link rel="icon" href="{% static 'img/brand/favicon.png' %}" type="image/png">
<link rel="stylesheet" href="{% static 'libs/@fortawesome/fontawesome-free/css/all.min.css' %}">
<link rel="stylesheet" href="{% static 'css/quick-website.css' %}" id="stylesheet">
Would HTTPS or HSTS settings conflict with anything within whitenoise?
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_SSL_REDIRECT = True
# HSTS Settings
SECURE_HSTS_SECONDS = 31536000 # 1 year
SECURE_HSTS_PRELOAD = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
from whitenoise.
Sorry I can’t really help any more. I hope you can debug the issue my making requests direct to your origin server and tracing them.
from whitenoise.
No worries. I almost have it completely working now. I think it was more of a misunderstanding on my part regarding Heroku. To get it working, I had to run collectstatic
from my development environment and then push the optimized files to production. Previously, I was running collectstatic
from production instead. Works fine now, except for one js file.
Thanks.
from whitenoise.
It does work to run collectstatic
locally, and commit the assets, but that’s not the intended method.
The default Django deployment setup has you run collectstatic
in your build process, for your production environment. Heroku does this by default, if it can detect your manage.py
, unless you disable it with an env var. Refer to the Heroku docs for collectstatic.
from whitenoise.
Related Issues (20)
- SSL handshake and open() errors after enabling whitenoise HOT 1
- Python 3.11 support? HOT 2
- Should not handle POST, PUT or DELETE HTTP methods? HOT 2
- Can some files be excluded? HOT 1
- Static files not found / bad args passed to finders.find (dev, Windows) HOT 2
- Azure app service web application is throwing 500 internal server error when using whitenoise - CompressedManifestStaticFilesStorage and DEBUG = False HOT 5
- Clarify interaction between WHITENOISE_KEEP_ONLY_HASHED_FILES and WHITENOISE_ROOT HOT 2
- Clarification for using whitenoise with CDN on digital ocean HOT 2
- do not raise exception if sourceMappingURL rereferenced map is missing HOT 1
- Documentation pointer for nginx users HOT 3
- whitenoise.storage.MissingFileError HOT 1
- Upgrade to Django 4.2 raises new warning HOT 9
- `render` and `redirect` not working with Django, Gunicorn, and Whitenoise HOT 2
- Merge ASGIWhiteNoise HOT 3
- Django app on Azure: STORAGES (previously STATICFILES_STORAGE) WhiteNoise variable breaks application HOT 1
- Random PostgreSQL connection errors HOT 12
- whitenoise's scantree slows down test suite performance HOT 9
- STORAGES results in Server Error 500 HOT 6
- ValueError: Missing staticfiles manifest entry for 'css/animate.css' & results in Server Error 500
- [Question] Under what set of circumstances is WHITENOISE_MANIFEST_STRICT evaluated? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from whitenoise.