【问题标题】:django-storages and boto ImproperlyConfigureddjango-storages 和 boto 配置不当
【发布时间】:2014-07-23 10:45:21
【问题描述】:

当我的 django 驱动的网站尝试上传文件时,我收到此错误:

ImproperlyConfigured at /~~~
Could not load Boto's S3 bindings.
See https://github.com/boto/boto

我调查发现from boto import __version__ as boto_version这行失败了。删除周围的 try-catch 语句会出现此错误:

Error importing module storages.backends.s3boto: "cannot import name __version__"

这通常表示循环导入,但我似乎找不到。使用 django shell(使用:python manage.py shell 调用),我可以按预期导入和操作 boto 和 S3BotoStorage。我无法在页面呈现之外重新创建此错误。

我有最新版本的 boto 和 django-storages,并且 storages 已添加到 INSTALLED_APPS。

$ pip show boto django-storages
---
Name: boto
Version: 2.30.0
...
---
Name: django-storages
Version: 1.1.8
... 
$ python manage.py shell
>>> import boto
>>> boto.__version__
'2.30.0'
>>> from storages.backends.s3boto import S3BotoStorage
>>> b = S3BotoStorage()
>>> b.get_available_name('foo')
'foo'
$ cat settings.py | grep 'storages'
INSTALLED_APPS += ('storages',)
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'

是什么导致了这个错误,如何解决,感谢您提供的任何帮助。

【问题讨论】:

    标签: python django amazon-web-services boto


    【解决方案1】:

    我遇到了同样的问题,我不确定为什么这解决了这个问题,但我将 boto 升级到了 2.31.1 版,一切又开始工作了。希望这会有所帮助:

    pip install boto --upgrade
    

    【讨论】:

    • 谢谢,我现在遇到了其他问题,但我发布的那个已经消失了。
    猜你喜欢
    • 2012-05-01
    • 1970-01-01
    • 2011-03-24
    • 1970-01-01
    • 2013-12-06
    • 2016-02-12
    • 2014-09-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多