Git Product home page Git Product logo

flask-s3-uploader's Issues

Thanks for this!

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?

RuntimeError: working outside of application context

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.

The problem

$ 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

Steps to reproduce

$ 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

Notes

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.