bkpaas-python-sdk icon indicating copy to clipboard operation
bkpaas-python-sdk copied to clipboard

bkstorages的get_modified_time函数报错

Open hopeaktian opened this issue 1 year ago • 0 comments

环境版本:

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"

hopeaktian avatar Jan 16 '25 02:01 hopeaktian