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.