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

Setting up a new Git repository


As before, we need to create a new git repository to host our new project. The first step is to go to log into the web interface of BitBucket or whichever code repository host you are using, select the Create a new Repository option, and select the Git radio option, taking note of the URL with which it provides you. As the next steps are identical to the previous projects, we will give you only a summary. If you need more fine-grained guidance, refer to the Installing and using git section of Chapter 1, Hello, World!.

Setting up the new project locally

To set up the local project structure, run the following commands locally:

mkdir waitercaller
cd waitercaller
git init
git remote add origin <new-repository-url>
mkdir templates
mkdir static
touch waitercaller.py
touch templates/home.html
touch .gitignore

We want to get the minimal running app for this project so that we can iron out any configuration issues before we get started with development. Add the...