Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bkstorages的get_modified_time函数报错 #212

Open
hopeaktian opened this issue Jan 16, 2025 · 0 comments
Open

bkstorages的get_modified_time函数报错 #212

hopeaktian opened this issue Jan 16, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@hopeaktian
Copy link

hopeaktian commented Jan 16, 2025

环境版本:

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"

@piglei piglei added the bug Something isn't working label Jan 16, 2025
@narasux narasux self-assigned this Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants