--
Ticket URL: <https://code.djangoproject.com/ticket/29983>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Curtis Maloney
* status: new => assigned
* stage: Unreviewed => Accepted
Comment:
I was helping this user on IRC, and they were getting confusing errors
when running "collectstatic" or "findstatic" about the path not matching.
It turned out to be a conflict with joining Windows-style paths with Unix-
style paths, as mentioned above.
I'm going to look at replacing uses of os.path.join and its ilk with
pathlib, which does not suffer this problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:1>
Comment (by Tim Graham):
I'm surprised this hasn't come up before. What does the error look like?
The documentation for `STATICFILES_DIRS` days, "these paths should use
Unix-style forward slashes, even on Windows". I guess the problem is that
the way `BASE_DIR` is generated on Windows using backslashes. It's not
clear to me what Django can do about this but we'll see what Curtis comes
up with.
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:2>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:3>
* component: contrib.staticfiles => Core (Other)
* needs_better_patch: 0 => 1
* type: Bug => Cleanup/optimization
Comment:
The patch doesn't work because `os.path.join(BASE_DIR, 'db.sqlite3')`
returns a string while `BASE_DIR / 'db.sqlite3'` returns a `PosixPath`.
The documentation would have to use `str(BASE_DIR / 'db.sqlite3')`
everywhere or Django would have to convert `PosixPath` to string.
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:4>
* needs_better_patch: 1 => 0
Comment:
I have resurrected the original patch with a fix for SQLite.
[https://github.com/django/django/pull/12005 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:5>
Comment (by Claude Paroz):
I'm not sure if various Django settings requiring a path (template `DIRS`,
`STATIC/MEDIA_ROOT`, etc.) all support path inputs. Shouldn't we check and
add tests for those before changing the project settings template?
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:6>
* owner: Curtis Maloney => Jon Dufresne
* needs_tests: 0 => 1
Comment:
Assigning Jon, since he's picked this up; marking as needs tests, since I
think Claude is right, we have had regressions from moving to `Path`.
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:7>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"92e5abd7a3dbbea88b3d43d5790f94e276bc6dff" 92e5abd7]:
{{{
#!CommitTicketReference repository=""
revision="92e5abd7a3dbbea88b3d43d5790f94e276bc6dff"
Refs #29983 -- Added test for FIXTURES_DIRS pathlib support.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:8>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"1c4c68dfed289093aaa2baf86bac7826c91e59ce" 1c4c68d]:
{{{
#!CommitTicketReference repository=""
revision="1c4c68dfed289093aaa2baf86bac7826c91e59ce"
Refs #29983 -- Added test for FILE_UPLOAD_TEMP_DIR pathlib support.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:9>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"fbbff7f80870bc3e98de4a2fc9cd853949842fd0" fbbff7f]:
{{{
#!CommitTicketReference repository=""
revision="fbbff7f80870bc3e98de4a2fc9cd853949842fd0"
Refs #29983 -- Added pathlib.Path support to the file email backend.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:10>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"74f2a58b3a5319d2d450c367293f03ad88c10894" 74f2a58b]:
{{{
#!CommitTicketReference repository=""
revision="74f2a58b3a5319d2d450c367293f03ad88c10894"
Refs #29983 -- Added tests for FileBasedCache pathlib support.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:11>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"77aa74cb70dd85497dbade6bc0f394aa41e88c94" 77aa74c]:
{{{
#!CommitTicketReference repository=""
revision="77aa74cb70dd85497dbade6bc0f394aa41e88c94"
Refs #29983 -- Added support for using pathlib.Path in all settings.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:12>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:13>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"26554cf5d1e96db10d0d5f4b69683a22fb82fdf8" 26554cf5]:
{{{
#!CommitTicketReference repository=""
revision="26554cf5d1e96db10d0d5f4b69683a22fb82fdf8"
Fixed #29983 -- Replaced os.path() with pathlib.Path in project template
and docs.
Thanks Curtis Maloney for the original patch.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:14>
Comment (by Carlton Gibson <carlton@…>):
In [changeset:"150c3d13a6fdf1a89a0fa90a8f8687fe3757a015" 150c3d13]:
{{{
#!CommitTicketReference repository=""
revision="150c3d13a6fdf1a89a0fa90a8f8687fe3757a015"
Refs #29983 -- Fixed displaying pathlib.Path database name in flush
command's inputs.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29983#comment:15>