每当我使用flask-migrate框架运行诸如flask db migrate或flask db upgrade类的命令时,它总是开始在localhost上运行我的应用程序,并且在允许服务器停止并生成迁移之前我必须按CTRL+C退出。 我怎么能避免这个?
我遇到的另一个问题是,每当我运行时,它将首先在调试模式下运行,在点击CTRL+C退出后,它将再次运行而不启用调试模式,在另一个端口上运行。 我怎么只限制与前者一起跑步? 谢谢。
Whenever I run a command like flask db migrate or flask db upgrade using the flask-migrate framework, it always starts running my application on localhost, and I have to press CTRL+C to quit before allowing the server to stop and generate the migration. How can I avoid this?
Another question I have is whenever I run, it will first run it in debug mode and after hitting CTRL+C to quit it will again run without debug mode on, on a different port. How do I only limit to running with the former? Thanks.
最满意答案
您的应用程序中的某个位置有app.run()调用。 Flask运行您的应用程序本身,这个额外的调用是导致db命令在执行命令之前运行服务器的调用,并且还导致服务器在执行flask run时运行两次。 如果您发现并删除此行,我认为您会没事的。
Somewhere within your application you have a app.run() call. Flask runs your application itself, this extra call is the one that is causing the db commands to run the server before carrying out the command, and also causes the server to run twice when you do flask run. If you find that and remove this line I think you will be fine.
更多推荐
发布评论