Connexion: App has no attribute config

Created on 12 Apr 2017  路  4Comments  路  Source: zalando/connexion

Description

I want to save a string in the app object like in flask

Expected behaviour

I expect to save it like
app.config['UPLOAD_FOLDER'] = 'some/path/name_of_folder'

Actual behaviour

AttributeError: 'FlaskApp' object has no attribute 'config'

Steps to reproduce

app = connexion.App(__name__)
app.add_api('swagger.yaml')
app.config['UPLOAD_FOLDER'] = 'some/path/name_of_folder'

Additional info:

Output of the commands:

  • Python 3.4.2

  • connexion -> Version: 1.1.9

Most helpful comment

Thank you, so the command is:
->$ app.app.config['UPLOAD_FOLDER'] = 'some/path/name_of_folder'

All 4 comments

You can access it via "connexion.App().app"

Thank you, so the command is:
->$ app.app.config['UPLOAD_FOLDER'] = 'some/path/name_of_folder'

So how do you access the UPLOAD_FOLDER config value in, say, a controller?

@randyesq I did this successfully from a controller file, found under <project>/controllers/default_controller.py:

from flask import current_app

def read(limit=1):
    return current_app.config['FOO_BAR']
Was this page helpful?
0 / 5 - 0 ratings