django-storage

Error “Could not load Boto's S3 bindings.”

谁都会走 提交于 2019-12-21 03:35:24
问题 I have followed the very terse guide provided for django-storages, transitioned from local file storage, and have come up against this exception: Could not load Boto's S3 bindings. settings.py DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_ACCESS_KEY_ID = "xxxxxx" AWS_SECRET_ACCESS_KEY = "xxxxxxxxx" AWS_STORAGE_BUCKET_NAME = "images" models.py class CameraImage(models.Model): ... image = models.ImageField(upload_to='images')#get_image_path) What does that exception mean?

Pointing to multiple S3 buckets in s3boto

佐手、 提交于 2019-12-20 09:57:21
问题 In settings.py I have: STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_ACCESS_KEY_ID = 'xxxxxxxxxxxxx' AWS_SECRET_ACCESS_KEY = 'xxxxxxxxxxxxx' AWS_STORAGE_BUCKET_NAME = 'static.mysite.com' This is pointing to my S3 bucket static.mysite.com and works fine when I do manage.py collectstatic , it uploads all the static files to my bucket. However, I have another bucket which I use for different purposes and would

collectstatic incorrectly creates multiple CSS files in S3

点点圈 提交于 2019-12-18 07:21:16
问题 I have uploading files to S3 working fine with my Wagtail/django application (both static and uploads). Now I'm trying to use ManifestStaticFilesStorage to enable cache busting. The urls are correctly being generated by the application and files are being copied with hashes to S3. But each time I run collectstatic some files get copied twice to S3 - each with a different hash. So far the issue is ocurring for all CSS files. file.a.css is loaded by the application and is the file referenced in

boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden

本秂侑毒 提交于 2019-12-17 07:09:15
问题 I'm trying to get django to upload static files to S3, but istead I'm getting a 403 forbidden error, and I'm not sure why. Full Stacktrace: Traceback (most recent call last): File "manage.py", line 14, in <module> execute_manager(settings) File "/home/levi/Projects/DoneBox/.virtualenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/home/levi/Projects/DoneBox/.virtualenv/local/lib/python2.7/site-packages/django/core

boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden

守給你的承諾、 提交于 2019-12-17 07:09:09
问题 I'm trying to get django to upload static files to S3, but istead I'm getting a 403 forbidden error, and I'm not sure why. Full Stacktrace: Traceback (most recent call last): File "manage.py", line 14, in <module> execute_manager(settings) File "/home/levi/Projects/DoneBox/.virtualenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/home/levi/Projects/DoneBox/.virtualenv/local/lib/python2.7/site-packages/django/core

changing django-storages backend from from s3 to cloudfiles and dealing with old files

£可爱£侵袭症+ 提交于 2019-12-12 15:07:11
问题 I've got a django app that I'm moving to rackspace. I have a model that uses FileFields and I'm using the django-storages library s3/boto backend. I want to use cloudfiles for storage, and I need to be able to serve up the old s3 content. On a template page where I provide links to the files, I do this: href="{{ static_url }}{{ article.code_archive_file}}" static_url is set from the view and equals settings.STATIC_URL . Clearly this isn't going to work since settings.STATIC_URL is going to

How to dynamically select storage option for models.FileField?

谁都会走 提交于 2019-12-12 04:07:22
问题 Depending on the file extension, I want the file to be stored in a specific AWS bucket. I tried passing a function to the storage option, similar to how upload_to is dynamically defined. However, this doesn't give the desired results. In my template, when I try href to document.docfile.url, the link doesn't work. Checking in the shell, this happens Document.objects.all()[0].docfile.storage.bucket <Bucket: <function aws_bucket at 0x110672050>> Document.objects.all()[0].docfile.storage.bucket

Updated MEDIA_URL not reflected in ImageField url

寵の児 提交于 2019-12-12 04:05:12
问题 I'm trying to move from serving files on Amazon S3 to Amazon CloudFront, so I updated my settings.py . Previously, I had this: S3_URL = 'http://{}.s3.amazonaws.com'.format(AWS_STORAGE_BUCKET_NAME) STATIC_URL = S3_URL + STATIC_DIRECTORY MEDIA_URL = S3_URL + MEDIA_DIRECTORY I updated this as follows: #S3_URL = 'http://{}.s3.amazonaws.com'.format(AWS_STORAGE_BUCKET_NAME) S3_URL = 'http://d2ynhpzeiwwiom.cloudfront.net' In the console, the settings are updated: >>> from django.conf import settings

ImportError: cannot import name 'safe_join'

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 01:22:08
问题 I want to upload my static files to AWS CloudFront through s3. I have this error : ImportError: cannot import name 'safe_join' when running python manage.py collectstatic I am using Python 3.6 and Django 2x. django-storage-redux is installed, boto3 and botocore too. here is my settings.py : import os from django.utils.translation import ugettext_lazy as _ import boto3 ... # AWS CloudFront AWS_S3_REGION_NAME = 'us-east-2' # e.g. us-east-2 AWS_ACCESS_KEY_ID = '****' AWS_SECRET_ACCESS_KEY = '***

Django manage.py collectstatic not uploading to google cloud storage

会有一股神秘感。 提交于 2019-12-11 12:49:04
问题 Experience level with issue This is my first experience with deploying static files and using Django. Issue When I run python manage.py collectstatic I will get the following result: 2 static files copied to '/home/ymorin007/workspace/sites/onbytes.com/onbytes-static', 151 unmodified, 4 post-processed. But nothing is beeing push to my bucket in google cloud storage. I'm not getting any errors in the terminal. Anything I'm missing her? My code I'm using django-storages This is the following