bkpaas-python-sdk
bkpaas-python-sdk copied to clipboard
bkstorages的get_modified_time函数报错
环境版本:
python3.6 Django==2.2.6 bkstorages==1.0.6
default.py设置:
USE_TZ = True TIME_ZONE = 'Asia/Shanghai' LANGUAGE_CODE = 'zh-hans'
问题代码:
from django.core.files.storage import default_storage modified_time = default_storage.get_modified_time(file_path)
报错信息:
modified_time = default_storage.get_modified_time(file_path)\n File "/app/.heroku/python/lib/python3.6/site-packages/bkstorages/backends/bkrepo.py", line 412, in get_modified_time\n return localtime(dt)\n File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/timezone.py", line 207, in localtime\n raise ValueError("localtime() cannot be applied to a naive datetime")\nValueError: localtime() cannot be applied to a naive datetime\n"