Why does running the Flask dev server run itself twice?

前端 未结 6 2113
南旧
南旧 2020-11-22 01:39

I\'m using Flask for developing a website and while in development I run flask using the following file:

#!/usr/bin/env python
from datetime import datetime
         


        
6条回答
  •  不思量自难忘°
    2020-11-22 02:39

    From Flask 0.11, it's recommended to run your app with flask run rather than python application.py. Using the latter could result in running your code twice.

    As stated here :

    ... from Flask 0.11 onwards the flask method is recommended. The reason for this is that due to how the reload mechanism works there are some bizarre side-effects (like executing certain code twice...)

提交回复
热议问题