I got following error:
RuntimeError: cannot access configuration outside request
from executing following code:
# -*- coding: u
You haven't configured the Flask-Uploads extension. Use the configure_uploads() function to attach your upload sets to your app:
from flaskext.uploads import UploadSet, configure_uploads
app = Flask(__name__)
app.config['UPLOADED_CSVFILES_DEST'] = '/var/uploads'
csvfiles = UploadSet('csvfiles', ('csv',))
configure_uploads(app, (csvfiles,))
The second argument to UploadSet() takes a sequence of extensions. Don't pass in the file path to an UploadSet; you would use your Flask configuration instead.
Set UPLOADED_<name-of-your-set>_DEST, where the name is uppercased. Here that's UPLOADED_CSVFILES_DEST. You can also set a UPLOADS_DEFAULT_DEST configuration; it'll be used as a base directory, with separate subdirectories for each set name.
Alternatively, that 3rd parameter can be a callable:
configure_uploads(app, (csvfiles,), lambda app: '/var/uploads')