django-static-precompiler
django-static-precompiler copied to clipboard
compilestatic broken on windows directory names.
I discovered this bug while running on windows. In compilestatic.py (lines 29 and 30) it does this:
if path.startswith("/"):
path = path[1:]
This obviously wouldn't work for windows because it uses backslashes. And I was hitting a bug down the line where os.path.join was returning an absolute path instead of merging it with STATIC_ROOT.
I added the fix for this case as:
if path.startswith("/") or path.startswith("\\"):
path = path[1:]
Which fixed the problem. But I noticed this assumption of the unix separator is done in more places (e.g. watch.py) in the codebase and may require a bigger refactoring to make sure everything works on windows.
Hello @shaladi
Could you provide some sample code of how you use the compile template filter?