Skip to Content
Flask By Example
book

Flask By Example

by Gareth Dwyer
March 2016
Intermediate to advanced
276 pages
6h 48m
English
Packt Publishing
Content preview from Flask By Example

Displaying existing crimes on our map

Now, the user can add new crimes to our crime database, but we want the map to display crimes that are already added as well. To achieve this, whenever the page is loaded, our app needs to make a call to the database to get the latest crime data. We then need to pass this data to our template file, loop through each crime, and place a marker in the correct place on the map.

Now, our data is stored in a MySQL database. We will access it using Python on the server side, and we want to display it using JavaScript on the client side; so, we'll need to spend a bit of time on converting our data to the appropriate format. When we access the data through our Python pymysql driver, we will receive it as a tuple. To ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Flask

Mastering Flask

Jack Stouffer
Flask Blueprints

Flask Blueprints

Joel Perras

Publisher Resources

ISBN: 9781785286933Supplemental Content