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

django4.0后用不了了 #42

Open
zsq44 opened this issue May 26, 2023 · 1 comment
Open

django4.0后用不了了 #42

zsq44 opened this issue May 26, 2023 · 1 comment

Comments

@zsq44
Copy link

zsq44 commented May 26, 2023

django.core.files.storage.handler.InvalidStorageError: Could not find backend 'django_oss_storage.backends.OssMediaStorage': cannot import name 'force_text' from 'django.utils.encoding'

这当中的force_text,应该是在新版本的django中被移除了。

@s045pd
Copy link

s045pd commented Nov 24, 2023

django.core.files.storage.handler.InvalidStorageError: Could not find backend 'django_oss_storage.backends.OssMediaStorage': cannot import name 'force_text' from 'django.utils.encoding'

这当中的force_text,应该是在新版本的django中被移除了。

在项目的 settings.py 顶部加上

import django
from django.utils.encoding import force_str
django.utils.encoding.force_text = force_str

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants