-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
How to access db connection stored in app from subapp #2412
Comments
asvetlov
added a commit
that referenced
this issue
Oct 26, 2017
Answered in #2413 |
thanks |
Plz open a new issue, this is going to get lost. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Long story short
I'm trying to find a way to access the database connection details stored in app (via dict-like interface) from the subapp.
Expected behaviour
There must be some access method like subapp.get_root_app() so that I can then use that to get the database connections stored via subapp.get_root_app()['db']
Actual behaviour
I can't find anything in the documentation that shows a way to do this. So I'm using the following approach:
Then in the subapp's request handler, I'm doing request.app['parent']['db'] - it works when I know that the subapp is just one level below main/parent app. But what if there are nested subapps?
Steps to reproduce
As shown above.
Your environment
CentOS / aiohttp 2.3 / Nginx
The text was updated successfully, but these errors were encountered: