如何在django rest框架中使用app engine在google云存储中上传图像?
我已经执行了以下步骤,但底部的错误仍不断出现:如何在django rest框架中使用app engine在google云存储中上传图像?,django,python-3.x,google-app-engine,django-rest-framework,Django,Python 3.x,Google App Engine,Django Rest Framework,我已经执行了以下步骤,但底部的错误仍不断出现: install pip install django-google-cloud-storage 发现导入错误-没有名为storages的模块 我也尝试过这个教程 配置 在django settings.py文件中,需要添加以下设置 GOOGLE_CLOUD_STORAGE_BUCKET = '/your_bucket_name' # the name of the bucket you have created from the goo
install pip install django-google-cloud-storage
发现导入错误-没有名为storages的模块
我也尝试过这个教程
配置
在django settings.py文件中,需要添加以下设置
GOOGLE_CLOUD_STORAGE_BUCKET = '/your_bucket_name' # the name of the bucket you have created from the google cloud storage console
GOOGLE_CLOUD_STORAGE_URL = 'http://storage.googleapis.com/bucket' #whatever the ulr for accessing your cloud storgage bucket
GOOGLE_CLOUD_STORAGE_DEFAULT_CACHE_CONTROL = 'public, max-age: 7200' # default cache control headers for your files
And finally declare the file storage backend you will use on your settings.py file
DEFAULT_FILE_STORAGE = 'django_google_cloud_storage.GoogleCloudStorage'
ModuleNotFoundError位于/api/photo\u docs/
没有名为“django\u google\u cloud\u storage”的模块因为您使用的是Python 3,所以应该使用pip3而不仅仅是pip。这应该可以解决问题并修复错误。请您将问题的格式设置得更清楚一点,并添加您尝试过的内容、成功/失败的内容以及任何代码。您可以共享您的设置吗。py?为了得到一个更好的视角,我认为你在关注,对吗?我在关注这个教程
GOOGLE_CLOUD_STORAGE_BUCKET = '/your_bucket_name' # the name of the bucket you have created from the google cloud storage console
GOOGLE_CLOUD_STORAGE_URL = 'http://storage.googleapis.com/bucket' #whatever the ulr for accessing your cloud storgage bucket
GOOGLE_CLOUD_STORAGE_DEFAULT_CACHE_CONTROL = 'public, max-age: 7200' # default cache control headers for your files
And finally declare the file storage backend you will use on your settings.py file
DEFAULT_FILE_STORAGE = 'django_google_cloud_storage.GoogleCloudStorage'