Book Image

Flask By Example

By : Gareth Dwyer
Book Image

Flask By Example

By: Gareth Dwyer

Overview of this book

This book will take you on a journey from learning about web development using Flask to building fully functional web applications. In the first major project, we develop a dynamic Headlines application that displays the latest news headlines along with up-to-date currency and weather information. In project two, we build a Crime Map application that is backed by a MySQL database, allowing users to submit information on and the location of crimes in order to plot danger zones and other crime trends within an area. In the final project, we combine Flask with more modern technologies, such as Twitter's Bootstrap and the NoSQL database MongoDB, to create a Waiter Caller application that allows restaurant patrons to easily call a waiter to their table. This pragmatic tutorial will keep you engaged as you learn the crux of Flask by working on challenging real-world applications.
Table of Contents (20 chapters)
Flask By Example
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
Index

Adding cookies to our Headlines application


Our application, at this point, has a couple of issues. Let's imagine a user, Bob, who lives in Seattle. Bob visits our site and sees the defaults for BBC, London, and conversion of GBP to USD. Bob wants to see the weather for Seattle, so he types Seattle into the Weather search bar and hits Enter. He glances at the returned weather and feels pretty depressed that it's cold and raining as usual, so he looks away from the weather further down the page and sees the BBC headlines. He would prefer CNN headlines, so he selects this publication from the drop-down menu and hits Submit. He reads through a couple of headlines before realizing that current affairs are even duller and more depressing than the weather. So, his eyes move back to the top of the page again to cheer himself up. He's confused; since changing his publication preference, the weather has defaulted back to London, where the weather is even worse! He closes our application and doesn...