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

flask-context #45

Closed
shitone opened this issue May 28, 2017 · 2 comments
Closed

flask-context #45

shitone opened this issue May 28, 2017 · 2 comments
Labels

Comments

@shitone
Copy link

shitone commented May 28, 2017

Hi, @viniciuschiele :
I read the example flask_context.py. I have some questions about that.

  1. Is the the app stored in the database? And then we get the app from database through db.app?
  2. If I don't wanna use database, how could I get the app context in the thread?
    Thank you!
@viniciuschiele
Copy link
Owner

Hi @shitone

The app variable is the Flask app and it is not stored in database, I just set db.app = app because app is not a global variable and I needed to access it within my task.

db is a global variable so that within the task you can get the db object to access the database.

The app variable could also be a global variable, in such case you wouldn't need to set db.app = app

I don't know if I was clear, let know if you have more questions.

@shitone
Copy link
Author

shitone commented May 28, 2017

Got it! I'll have an try in my project. Thks.

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

No branches or pull requests

2 participants