server.py
#!/usr/bin/env python3
from connexion.resolver import RestyResolver
import connexion
def create_app():
app = connexion.FlaskApp(__name__, specification_dir='swagger/')
app.add_api('mapmybook.yaml',validate_responses=True, strict_validation=True, resolver=RestyResolver('api'))
return app
if __name__ == '__main__':
create_app().run(port=9090)
api/routes.py
from flask import current_app
def get() -> list:
print(current_app)
return items
results in RuntimeError: Working outside of application context.
I'm using Flask 1.0 with connexion 1.4.2, creating the app as seen above. Is there a way to access Flask's current_app from other modules?
I keep getting RuntimeError: Working outside of application context. when calling current_app in API modules.
Got it, app context is only available under certain conditions.
@zimmicz I still get these errors. Can you let me know how you solved your issue? I've tried so many things but I always get this error...
Same issue here...
Can we re-open this?
Any update on this? :\
Most helpful comment
Can we re-open this?