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

Introducing MongoDB


MongoDB is a NoSQL database. This means that unlike the MySQL database we used for our Crime Map project, it is not organized into tables, rows, and columns; instead, it is organized into collections, documents, and fields. While it can be useful to think of these new terms as a sort of translation from those we use for relational databases, the concepts do not perfectly translate. If you have a background in relational databases, a useful and more complete reference to these translations can be found on the official MongoDB website at https://docs.mongodb.org/manual/reference/sql-comparison/.

MongoDB's structure is much more flexible than that of a SQL database—not all of our data has to confirm to a specific schema, and this can save development time. For our Crime Map project, we had to spend time up front looking at our data and deciding how to represent it in a database. We then had to set up a bunch of fields, specifying the data type, length, and other constraints...