【问题标题】:Unable to create libcloud driver type. No CA certificates found. Google Cloud Storage and Django.无法创建 libcloud 驱动程序类型。未找到 CA 证书。谷歌云存储和 Django。
【发布时间】:2016-05-01 21:02:54
【问题描述】:

尝试在 Django 中为 Google Cloud Storage 配置存储处理程序。

我已经安装了 django-storages,并将storages 添加到我的INSTALLED_APPS

我已经安装了 apache-libcloud

我从https://curl.haxx.se/docs/caextract.html 下载了this file,并将其路径附加到CA_CERTS_PATH。我将 Mac OSX 与 Django 1.9 和最新版本的 Google SDK 一起使用。这是在我的本地环境中。

 # settings.py

libcloud.security.CA_CERTS_PATH.append(os.path.join(BASE_DIR, 'cacerts.pem'))

LIBCLOUD_PROVIDERS = {
    'google': {
        'type'  : 'libcloud.storage.types.Provider.GOOGLE_STORAGE',
        'user'  : <my user, hidden here>,
        'key'   : <my key, hidden as well>,
        'bucket': <bucket name>,
    }
}
DEFAULT_LIBCLOUD_PROVIDER = 'google'
DEFAULT_FILE_STORAGE = 'storages.backends.apache_libcloud.LibCloudStorage'
STATICFILES_STORAGE = 'storages.backends.apache_libcloud.LibCloudStorage'

Per these docs,我已经确认CA_CERTS_PATH肯定包含 cacerts.pem 文件。

然而,当我运行dev_appserver.py 时,我遇到了这个问题:

Unable to create libcloud driver type libcloud.storage.types.Provider.GOOGLE_STORAGE: No CA Certificates were found in CA_CERTS_PATH. For information on how to get required certificate files, please visit https://libcloud.readthedocs.org/en/latest/other/ssl-certificate-validation.html

我错过了什么?我的配置有什么问题 libcloud 不起作用?这是我第一次使用 Django 或 Google Cloud Storage 设置任何自定义存储配置。欢迎所有输入。

【问题讨论】:

    标签: certificate google-cloud-storage django-storage


    【解决方案1】:

    您是否尝试安装 curl-ca-bundle Mac OSX 端口或 openssl / curl-ca-bundle 自制软件包 (https://libcloud.readthedocs.io/en/latest/other/ssl-certificate-validation.html )?

    理论上,只要您的 CA 捆绑文件格式正确且路径正确,您的方法应该也可以正常工作,但这也取决于导入顺序以及 django-storages 如何导入 libcloud(如果它会在您设置 libcloud.security 设置后动态导入,您的设置不会产生影响)。

    【讨论】:

    • 有趣的想法。我将如何追踪进口订单? curl-ca-bundle 和 openssl 也是CA_CERTS_PATH ..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-15
    • 2016-01-31
    • 1970-01-01
    • 1970-01-01
    • 2020-08-25
    • 2023-02-06
    • 2018-01-28
    相关资源
    最近更新 更多