doobeh / flask-s3-uploader Goto Github PK
View Code? Open in Web Editor NEWA simple project to show how to use Flask with Amazon S3 to enable user's uploaded files to be stored directly to an S3 bucket
License: MIT License
A simple project to show how to use Flask with Amazon S3 to enable user's uploaded files to be stored directly to an S3 bucket
License: MIT License
We have a small service that we're building, basically using this as a model, we're new to flask, thanks for publishing it, it's really close to what we need. How about a license file?
Hi, I don't see any option to prevent certain file types... Is there any way ?
Hi,
I would like to report an issue I'm having with the uploader. In case that the solution will be of interest to others, I will be more than happy to update the documentation.
$ python app.py
Traceback (most recent call last):
File "app.py", line 4, in <module>
from tools import s3_upload
File "/private/tmp/Flask-S3-Uploader/tools.py", line 8, in <module>
def s3_upload(source_file, upload_dir=app.config["S3_UPLOAD_DIRECTORY"], acl='public-read'):
File "/private/tmp/Flask-S3-Uploader/flask-env/lib/python2.7/site-packages/werkzeug/local.py", line 342, in __getattr__
return getattr(self._get_current_object(), name)
File "/private/tmp/Flask-S3-Uploader/flask-env/lib/python2.7/site-packages/werkzeug/local.py", line 301, in _get_current_object
return self.__local()
File "/private/tmp/Flask-S3-Uploader/flask-env/lib/python2.7/site-packages/flask/globals.py", line 34, in _find_app
raise RuntimeError('working outside of application context')
RuntimeError: working outside of application context
$ git clone [email protected]:doobeh/Flask-S3-Uploader.git
$ cd Flask-S3-Uploader
$ virtualenv test_env
$ source test_env/bin/activate
$ pip install -r requirements.txt
$ pip freeze
Flask==0.10.1
Flask-WTF==0.12
Jinja2==2.8
MarkupSafe==0.23
WTForms==2.0.2
Werkzeug==0.11.2
boto==2.38.0
itsdangerous==0.24
wsgiref==0.1.2
$ python app.py
Traceback (most recent call last):
File "app.py", line 4, in <module>
from tools import s3_upload
File "/private/tmp/Flask-S3-Uploader/tools.py", line 8, in <module>
def s3_upload(source_file, upload_dir=app.config["S3_UPLOAD_DIRECTORY"], acl='public-read'):
File "/private/tmp/Flask-S3-Uploader/test_env/lib/python2.7/site-packages/werkzeug/local.py", line 342, in __getattr__
return getattr(self._get_current_object(), name)
File "/private/tmp/Flask-S3-Uploader/test_env/lib/python2.7/site-packages/werkzeug/local.py", line 301, in _get_current_object
return self.__local()
File "/private/tmp/Flask-S3-Uploader/test_env/lib/python2.7/site-packages/flask/globals.py", line 34, in _find_app
raise RuntimeError('working outside of application context')
RuntimeError: working outside of application context
I have not updates the config file yet, but it does not seem to be related - the error happens before the config file is read. Moreover, even if the details are wrong, the error should only be raised when a file is uploaded to S3 - the app.py
file should start normally.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.