I am trying to reroute all of my /static content to host on Amazon S3. My first thought was to use global config['path'] throughout my jinja templates, but this won't work for external css and js files, plus it is kind of messy. I found the static_folder and static_url_path released in 0.7 and this seems like what I want. However, when I go to http://localhost:8000/static/img/abc.jpg it does not locate the files on S3. Am I using this feature right or is there some other way to do this?
As an example, here is how you would integrate it into your Flask application:
from flask import Flask from flask_s3 import FlaskS3 app = Flask(__name__) app.config['S3_BUCKET_NAME'] = 'mybucketname' s3 = FlaskS3(app)
You can use the extension to upload your assets to your chosen bucket:
>>> from my_application import app >>> from flask_s3 import create_all >>> create_all(app)
Flask-S3 is blueprint aware, and will upload all assets associated with any registered blueprints.