Home > other >  In flask background using multi-threaded or with gevent about db and app unregistered errors
In flask background using multi-threaded or with gevent about db and app unregistered errors

Time:10-19

In flask background using multi-threaded or with gevent batch add data to the database, the following error:
"RuntimeError: application not registered on the db instance and no applicationbound
To the current context ", "
Could you tell me what causes and how to solve?

CodePudding user response:

With the app. The context ()

CodePudding user response:

If haven't solve stick source, an error writing should be not added to the context stack

CodePudding user response:

I am in the shell of the operation, the app in the shell and db registration:
CTX={" db ": db}
CTX. Update (current_app make_shell_context ())
It is not the mistakes if you do not use multithreading, but using multithreading is wrong, what is reason, do not allow the multithreaded operations app flask?

CodePudding user response:

reference weixin_42813540 reply: 3/f
I was operating in the shell, the app in the shell and the db registration:
CTX={" db ": db}
CTX. Update (current_app make_shell_context ())
It is not the mistakes if you do not use multithreading, but using multithreading is wrong, what is reason, do not allow the multithreaded operations app flask?
flask is when management context using multi-threading, you can go and see the context
  • Related