Flash cli encountered a keyerror “migrate” [How to Solve]

Flash management command-line tool. I use flash cli

Then, using any command related to flash DB will cause the problem of keyerror “migrate”

No solution was found on the Internet

Therefore, I started to think step by step and finally determined that the biggest problem without the migrate command was that when I executed the flash DB XX command, I didn’t find the corresponding app. The command line didn’t know which app I wanted to run, so I didn’t find the app associated with DB, that is, I didn’t find it

Migrate = migrate (APP = app, DB = dB), so an error is reported

Therefore, to use the flash command, you first need to declare flash_ APP

That is, enter in terminal

export FLASK_APP=The name of the app you want to run

=Do not leave a space before or after, otherwise bad assignment will be reported

Then enter flash DB migrate again and it will be normal

Read More: