Flask S3 Save Example
This app lets you upload, re-upload, and delete a single image. By changing a few lines of config, the image will be stored either locally, or in a S3 bucket of your choice.
Make sure you have installed:
- SQLite (3.8+ recommended)
- Python 2.7+ (and virtualenv)
- Pillow (Python image library)
Clone the flask-s3-save-example repo:
git clone firstname.lastname@example.org:Jaza/flask-s3-save-example.git cd flask-s3-save-example
Set up a (Python 2.7) virtualenv (recommended to use with
--system-site-packagesoption) and activate it, e.g:
mkdir env; cd env virtualenv --system-site-packages . source bin/activate cd ..
pip install -r requirements.txt
Create writable uploads / cache directory:
mkdir static mkdir static/uploads chmod 777 static/uploads mkdir static/cache chmod 777 static/cache
Sync the database (and create a DB and DB user if necessary):
./project/manage.py db upgrade
Create a super user to log in to the app:
Run the development server (defaults to port 5000):
./project/manage.py runserver -dr
Access the web front-end:
Access the admin by loging in:
False to store the image locally. If using S3, you'll need to set
AWS_SECRET_ACCESS_KEY to point to a bucket that the given AWS credentials can read / write to.
For a comprehensive guide of how to use the Flask S3 tools demonstrated here, see this blog post: