-
Notifications
You must be signed in to change notification settings - Fork 152
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
Warning shown if STATIC_ROOT directory missing in development #191
Comments
Thanks Ed, I hadn't considered this situation. I wonder if the correct behaviour would be just not to warn about missing directories if |
Yeah I think skipping the warning entirely if |
This fixes the slightly annoying behaviur in #191 but also makes conceptual sense: in autorefresh mode files and directories can not exist when the application starts and be added later, so it doesn't make sense to complain about their absence on startup.
Hi I've just started a new project with Whitenoise 4.0 and have exactly this problem - will there be a release that removes this warning in local dev? Thanks. |
@urlsangel Yep, the 4.1 release should be out soon which will include this fix |
Great stuff, thanks for your work on this! 👍 |
This fixes the slightly annoying behaviur in #191 but also makes conceptual sense: in autorefresh mode files and directories can not exist when the application starts and be added later, so it doesn't make sense to complain about their absence on startup.
This stops WhiteNoise from complaining about a missing STATIC_ROOT directory. See evansd/whitenoise#191.
This stops WhiteNoise from emitting warnings about STATIC_ROOT not existing. The alternative would be to set WHITENOISE_AUTOREFRESH = True in the settings. We currently don't have any settings that are only applied in CI and I think it makes sense to keep it that way to have the test environment as close to production as possible. See evansd/whitenoise#191 Signed-off-by: Haiko Schol <[email protected]>
@evansd - I'm using version 5.2.0 and still seeing this warning, is there something that I need to set on my end to eliminate this? |
I can confirm what @Br4nd0R is saying. This issue is still there in 5.2.0 |
Same here - 5.2.0 - I'm guessing a recent commit accidentally put it back in? |
Still here in 6.2. |
I noticed this while running tests locally. This can be worked around either by:
As for why this warning is being triggered even though it was though to have been fixed:
to its current:
The difference between these in That said, the test of existence, The original commit merged in 4.1 seems to have included a test stub. Currently, the test that should cover tests for the existence of a single warning. I wonder if a warning is being issued but it isn't the one expected by the failed directory check |
I can't remember what all things I referenced to make this work. I've been messing with it off and on all afternoon and evening createing and recreating and recreating projects. https://github.com/sloria/environs#reading-env-files https://learndjango.com/tutorials/template-structure evansd/whitenoise#191 (comment)
Hi! :-)
STR:
STATIC_ROOT
doesn't yet existDEBUG = True
, run./manage.py runserver
Expected:
No console warnings about a missing static files directory.
Actual:
Warning in the console:
Notes:
add_files()
in 2a883f5.STATIC_ROOT
directory, since:collectstatic
handles the creation of the directory automatically.gitkeep
type approach (which then causescollectstatic
to output misleading warnings/prompts about overwriting existing files) or else have additional local setup steps prior to running./manage.py runserver
.A possible solution might be to have
.add_files()
take an optionalignore_missing=False
argument, which is left asFalse
everywhere apart from the Django middleware static root usage. eg:That said, should
static_root
even be added when run inDEBUG
mode? The Django docs say not to place anything in theSTATIC_ROOT
directory directly, so it feels like there shouldn't be content there (though how many people go against that, I don't know).The text was updated successfully, but these errors were encountered: