Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_all() failing. #89

Open
zengoma opened this issue Jul 18, 2017 · 0 comments
Open

create_all() failing. #89

zengoma opened this issue Jul 18, 2017 · 0 comments

Comments

@zengoma
Copy link

zengoma commented Jul 18, 2017

Hi
I recently pushed all my static assets to s3 and set up cloudfront CDN successfully. Afterwards I realized that I forgot to set a Cache-Control header. I also added some additional assets. I'm receiving the following traceback error when running create_all() function:

Traceback (most recent call last):
  File "app/upload_assets.py", line 6, in <module>
    flask_s3.create_all(app)
  File "C:\projects\adminout\venv\lib\site-packages\flask_s3.py", line 453, in create_all
    _upload_files(s3, app, all_files, bucket_name)
  File "C:\projects\adminout\venv\lib\site-packages\flask_s3.py", line 318, in _upload_files
    names, bucket, hashes=hashes))
  File "C:\projects\adminout\venv\lib\site-packages\flask_s3.py", line 289, in _write_files
    merged_dicts = merge_two_dicts(get_setting('FLASKS3_HEADERS', app), h)
  File "C:\projects\adminout\venv\lib\site-packages\flask_s3.py", line 82, in merge_two_dicts
    z = x.copy()
AttributeError: 'tuple' object has no attribute 'copy'

My relevant app config:

...
    FLASKS3_BUCKET_NAME = 'mybucket'
    FLASKS3_GZIP = True
    FLASK_ASSETS_USE_S3 = True
    FLASK_ASSETS_USE_CDN = True
    FLASKS3_REGION = 'ap-south-1'
    FLASKS3_BUCKET_DOMAIN = u's3.ap-south-1.amazonaws.com'
    FLASKS3_CDN_DOMAIN = u'mycdn.cloudfront.net'
    FLASKS3_HEADERS = {
        'Cache-Control': 'max-age=84600'
    }
...

I am running the following python script to update my assets:

"""
Script for uploading latest assets to S3 bucket
"""
import flask_s3
from main import app
flask_s3.create_all(app)

My environment: Windows 10, Python 3.6.1 virtualenv.
Is this an issue or have I done something stupid? Please help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant