-
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 about Django's STATIC_ROOT directory not found when WHITENOISE_USE_FINDERS is true #215
Comments
Link to relevant bit of code: Lines 101 to 105 in 0e94fc1
|
Unfortunately there's no completely clean way of dealing with this. Ideally we'd set Probably the easiest thing to do is to silence the warning by adding something like the following to you settings file: import warnings
warnings.filterwarnings("ignore", message="No directory at", module="whitenoise.base" ) |
@evansd that's not a bad idea. For the time being we had worked around it by making sure that STATIC_ROOT was created with something like: if not os.path.isdir(STATIC_ROOT):
os.makedirs(STATIC_ROOT, mode=0o755) Thanks for considering the issue -- if there's no obvious fix maybe we could document the workaround ? |
My import pytest
@pytest.fixture(autouse=True)
def whitenoise_autorefresh(settings):
"""
Get rid of whitenoise "No directory at" warning, as it's not helpful when running tests.
Related:
- https://github.com/evansd/whitenoise/issues/215
- https://github.com/evansd/whitenoise/issues/191
- https://github.com/evansd/whitenoise/commit/4204494d44213f7a51229de8bc224cf6d84c01eb
"""
settings.WHITENOISE_AUTOREFRESH = True |
When you want to practice on ur local server ,Set Debug=True, and run server again. Problem Solved |
This works for me
|
im currently having this same issue while deploying to railway.app |
me too... oh God !!! |
@zamirszn @diegobarbo We are three now... |
@Ian2012 @diegobarbo did you guys get to fix it , i did by using the heroku build pack |
I am getting the same issue while running unit test |
Okay ... Getting this error on railway now ... |
Thanks for developing whitenoise 👍
I have a use case where I'd like whitenoise to transparently handle all the static files for a Django application. The amount of static files is minimal and gets little to no traffic.
Reproducing this particular issue should be fairly easy:
whitenoise.middleware.WhiteNoiseMiddleware
in the settings.pyMIDDLEWARE
listWHITENOISE_USE_FINDERS = True
in settings.pySTATIC_ROOT
to a path that doesn't exist yet (because Django creates this only when running collectstatic, which I'd actually like to avoid)Running
manage.py runserver
will raise a warning like this:The warning isn't a blocker: it doesn't prevent runserver or a wsgi server from starting.
The warning might not be relevant when
WHITENOISE_USE_FINDERS
isTrue
, though.The text was updated successfully, but these errors were encountered: