-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
error of collectstatic for AttributeError: 'Path' object has no attribute 'startswith' #86
Comments
I solved this problem by |
I think you still use path the wrong way.
but not
When you need a str object, you should use |
wow! Thanks for your reply. You are correct. |
It turns out that environ, though a very good package, does a bit of a funny thing. Instead of relying on pathlib to do path stuff, it ships its own pathlib-alike. I'm guessing this is because it pre-dates pathlib, but regardless, and unfortunately, their built-in path library is a bit buggy. One type of bug is that it can't always compare strings with it's Path objects properly, throwing errors like those seen in: joke2k/django-environ#86 So, to fix this: Simply don't use the built-in pathlib-alike, and use the real pathlib library instead.
I ran into this bug too. I haven't read all of
Something about that combination made the built in The solution, which you can see here was to not use I'm not super familiar with this package and why it has its own pathlib-alike (guessing it pre-dates py3?), but I think I'd suggest removing it since it appears to have bugs and (probably?) isn't necessary anymore. Instead, we could pretty easily, I think, migrate people to pathlib in their settings, though that'd be a backwards incompatible change. |
This is on my plans, but right now I don't have enough time for that. I'll try to return to this topic a bit later |
t |
Question: Why I have to use
root
property ofPath
instance?1. First try
then, run
collectstatic
command print out:when I print out
STATICFILES_DIRS
not
path
strings butPath
instaces.2. so I tried
root
propertythen, run
collectstatic
will be:3. I used
root
property toMEDIA_ROOT
too.then,
collectstatic
runs without error.The text was updated successfully, but these errors were encountered: