Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App has no attribute config #438

Closed
TheBrunoLopes opened this issue Apr 11, 2017 · 4 comments
Closed

App has no attribute config #438

TheBrunoLopes opened this issue Apr 11, 2017 · 4 comments

Comments

@TheBrunoLopes
Copy link

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

@TheBrunoLopes TheBrunoLopes changed the title App has no atribute config App has no attribute config Apr 11, 2017
@rafaelcaricio rafaelcaricio added bug and removed bug labels Apr 12, 2017
@rafaelcaricio
Copy link
Collaborator

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

@TheBrunoLopes
Copy link
Author

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

@randyesq
Copy link

randyesq commented Jul 9, 2019

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

@djhaskin987
Copy link

@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']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants