Debian Codegraph @

django/core/checks/files.py

raw
1 from pathlib import Path
2
3 from django.conf import settings
4
5 from . import Error, Tags, register
6
7
8 @register(Tags.files)
9 def check_setting_file_upload_temp_dir(app_configs, **kwargs):
10 setting = getattr(settings, "FILE_UPLOAD_TEMP_DIR", None)
11 if setting and not Path(setting).is_dir():
12 return [
13 Error(
14 f"The FILE_UPLOAD_TEMP_DIR setting refers to the nonexistent "
15 f"directory '{setting}'.",
16 id="files.E001",
17 ),
18 ]
19 return []