Skip to content

create_all() failing. #89

Open
Open
@zengoma

Description

@zengoma

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions