我不知道为什么这个错误一直发生在我的终端
我目前的django版本,4.2.3 python版本,3.10.6
我的虚拟环境是打开的,我确实下载了这些pip
pip install boto3 pip install django-storages
和我的settings.py
INSTALLED_APPS=[
...
'storages',
]
and
DEFAULT_FILE_STORAGE='storages.backends.s3boto3.S3Boto3Storage'
好吧,然后,我试着运行我的服务器,python manage.py runserver
它出现了这些错误
**
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Python latest\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Python latest\lib\threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\User\Desktop\udemy react django e commerce\env\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\User\Desktop\udemy react django e commerce\env\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "C:\Users\User\Desktop\udemy react django e commerce\env\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "C:\Users\User\Desktop\udemy react django e commerce\env\lib\site-packages\django\core\management\__init__.py", line 394, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\User\Desktop\udemy react django e commerce\env\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\User\Desktop\udemy react django e commerce\env\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\User\Desktop\udemy react django e commerce\env\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\User\Desktop\udemy react django e commerce\env\lib\site-packages\django\apps\config.py", line 193, in create
import_module(entry)
File "C:\Python latest\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'storages'
**
这意味着我的终端无法获得存储模块,即使我下载了boto 3和django-storages,有人能帮助我吗?
谢谢你
1条答案
按热度按时间uqzxnwby1#
请仔细检查您是否已正确安装:
在django-storages文档中找到:
https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#configuration-settings
此设置适用于Django < v4.2
在你的例子中(Django > 4.2),用途:
在django-storages文档中找不到(v1.14 =目前最新版本):
真的有必要吗?