mirror of
https://github.com/django/django.git
synced 2025-06-05 11:39:13 +00:00
fix: absolute path test
This commit is contained in:
parent
92c0bced2a
commit
3c4a7560ea
@ -58,16 +58,16 @@ def check_file_based_cache_is_absolute(app_configs, **kwargs):
|
|||||||
for alias, config in settings.CACHES.items():
|
for alias, config in settings.CACHES.items():
|
||||||
if config.get("BACKEND").endswith("FileBasedCache"):
|
if config.get("BACKEND").endswith("FileBasedCache"):
|
||||||
alias_name = alias
|
alias_name = alias
|
||||||
location = config
|
location = config.get("LOCATION")
|
||||||
|
|
||||||
if (
|
if (
|
||||||
alias_name is not None
|
location is not None
|
||||||
and not pathlib.Path(location.get("LOCATION")).is_absolute()
|
and not pathlib.Path(location).is_absolute()
|
||||||
):
|
):
|
||||||
return Warning(
|
return [Warning(
|
||||||
f"Your '{alias_name}' cache LOCATION path is relative. Use an "
|
f"Your '{alias_name}' cache LOCATION path is relative. Use an "
|
||||||
f"absolute path instead.",
|
f"absolute path instead.",
|
||||||
id="caches.W003",
|
id="caches.W003",
|
||||||
)
|
)]
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user