Tuesday 15 July 2014

python - Flask: getting random repeated flash messages when flash() is in @app.before_request -


When I use Flash () in @ app.before_request, then I like the random number of similar entries looks like. Refreshing the page will give me repeated messages 1 to 4 times.

There are no redirects.

My code is just:

  if app.config ['INSTANCE'] == 'DEV': Flash ("This data is from DB development")   

You can access the list of waiting codes through flashes = session.get ('_flashes', []) . You can note that why you make some messages shine, this is because you are requesting multiple (but probably will not know it). Your web browser is probably asking for favicon.ico which is a request, therefore causes Flash, etc. If you are running in debug mode, your console window will handle all requests. For example, because of loading a simple flask instance in Chrome it shows:

  127.0.0.1 - - [21 / June / 2013 16:35:05] "GET / HTTP / 1.1 "200 - 127.0.0.1 - - [21 / Jun / 2013 16:35:05] I have a request to see the homepage" GET / Favicon.ico HTTP / 1.1 "404 -   

, Is asking for other chrome favicons (and it is being told that it does not exist).

No comments:

Post a Comment