-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
FileNotFoundError: No such file or directory (static) #1318
Comments
Does that directory exist? |
It didn't. Creating it didn't change the error. |
Odd. Give |
Versions:
Settings: STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
os.path.join(BASE_DIR, "case-manager", "public"),
os.path.join(BASE_DIR, "case-intake", "public")
]
After
I added this to settings:
I ran
|
You shouldn't put non-existing folders in Also, since Django collects files from apps and from |
Running Perhaps debug toolbar can do some sort of configuration sanity check and complain if:
…or other similar errors that prevent debug toolbar from starting. |
All of these checks make sense, but it seems to me they belong into Django itself. At first sight. |
I agree in principle. However (a) My Django app ran fine with these items in their incorrect state and (b) it might be hard to (or take a long time to) convince the Django team to include this in a release. If you don't think it's worth make changes to debug toolbar, hopefully this GitHub issue will help the next person solve the problem. |
Well, there certainly is a django-debug-toolbar bug to be fixed – django-debug-toolbar should still work even if other applications are configured incorrectly (and mention that staticfiles couldn't be collected, in this case) Maybe it's even worth it adding our own warnings in specific cases. This may be such a case. I'm torn. So: Certainly +1 on fixing the crash, -0 on adding checks for other apps. +0 for adding a check if other apps would silently ignore their misconfiguration but django-debug-toolbar doesn't / cannot. |
@matthiask for this particular case are you suggesting that we log a warning that the path specified didn't exist? Looking for clarification so I can write up a PR. I agree that I'm hesitant to have the toolbar start acting as a config/project debugger as there's a lot of functionality that would need to be built for that. However, it could be argued that it's within the toolbar's domain. |
@tim-schilling Thanks for the suggestion, that should work well! I had in mind that we'd show a note about it in the toolbar itself, but that would probably be much more work without being more useful at all (resp. even less useful, in my case the probability is bigger that I see a warning in the runserver console than somewhere inside a panel) |
If the django static files are misconfigured in some way or a directory doesn't exist, the toolbar should still run, but attempt to alert the user to the issue. Fixes jazzband#1318
Just letting you know I am running into the same thing. Seems like having non-existing statis files dir is working fine with Django, they just get skipped. So might be better to log at debug level as otherwise the logs gets spammed with warnings? |
Adds support for toolbar panels to validate the configuration/ integration for their own purposes. If the django static files are misconfigured in some way or a directory doesn't exist, the toolbar should still run, but attempt to alert the user to the issue. Fixes jazzband#1318
Adds support for toolbar panels to validate the configuration/ integration for their own purposes. If the django static files are misconfigured in some way or a directory doesn't exist, the toolbar should still run, but attempt to alert the user to the issue. Fixes jazzband#1318
I fixed the FileNotFoundError:
Please Note: this error cannot be caused by a third party library because django picks only one global setting and so if you specify a global setting e.g STATICFILES_DIRS, it will override the one that would for instance be set in the third party package.
HAPPY CODING! |
Same as #1123.
I installed django-debug-toolbar. When I start my app, I get this error:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/paul/.dev/police-records/static'
Here's the backtrace:
The text was updated successfully, but these errors were encountered: