Skip to content

Commit c9abdda

Browse files
committed
working on new posts
1 parent fa23a8e commit c9abdda

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ Posts and associated code:
77

88
|Post|Code Directory|
99
|---|---|
10-
|[Monitoring Django Projects with Rollbar](https://www.fullstackpython.com/blog/monitor-django-projects-web-apps-rollbar.html)|[monitor-django-apps](./monitor-django-apps)|
10+
|How to Add Map Visualizations to Flask Web Apps with Mapbox|[maps-flask-mapbox](./maps-flask-mapbox)|
11+
|Monitoring Python 3.6 Code on AWS Lambda|[monitor-aws-lambda-python-3-6](./monitor-aws-lambda-python-3-6)|
1112
|[Developing Flask Apps in Docker Containers on macOS](https://www.fullstackpython.com/blog/develop-flask-web-apps-docker-containers-macos.html)|[docker-flask-mac](./docker-flask-mac)|
13+
|[Monitoring Django Projects with Rollbar](https://www.fullstackpython.com/blog/monitor-django-projects-web-apps-rollbar.html)|[monitor-django-apps](./monitor-django-apps)|
1214
|[First Steps with GitPython](https://www.fullstackpython.com/blog/first-steps-gitpython.html)|[first-steps-gitpython](./first-steps-gitpython)|
1315
|[DevOps, Thank You Maintainers and Contributing to Open Source](https://www.fullstackpython.com/blog/devops-python-maintaining-contributing-open-source.html)|No code in post.|
1416
|[DevOps, Continuous Delivery... and You](https://www.fullstackpython.com/blog/devops-continuous-delivery-you.html)|No code in post.|

maps-flask-mapbox/templates/map.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
<meta name="description" content="Visualize the logs of your Git repositories.">
7+
<meta name="author" content="Matt Makai">
8+
<title>Flask Map Example</title>
9+
<script src='https://api.mapbox.com/mapbox-gl-js/v0.44.2/mapbox-gl.js'></script>
10+
<link href='https://api.mapbox.com/mapbox-gl-js/v0.44.2/mapbox-gl.css' rel='stylesheet' />
11+
</head>
12+
<body>
13+
<h1>Mapping in a Flask App</h1>
14+
<div id='map' width="100%" style='height: 500px;'></div>
15+
<script>
16+
mapboxgl.accessToken = 'your access token';
17+
var map = new mapboxgl.Map({
18+
container: 'map',
19+
style: 'mapbox://styles/mapbox/streets-v10'
20+
});
21+
</script>
22+
</body>
23+
</html>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import os
2+
import rollbar
3+
4+
5+
ROLLBAR_KEY = os.getenv('ROLLBAR_SECRET_KEY', 'missing Rollbar secret key')
6+
rollbar.init(ROLLBAR_KEY, 'production')
7+
8+
9+
@rollbar.lambda_function
10+
def lambda_handler(event, context):
11+
what_to_print = os.environ.get("what_to_print")
12+
how_many_times = int(os.environ.get("how_many_times"))
13+
14+
# make sure what_to_print and how_many_times values exist
15+
if what_to_print and how_many_times > 0:
16+
for i in range(0, how_many_times):
17+
# formatted string literals are new in Python 3.6
18+
print(f"what_to_print: {what_to_print}.")
19+
return what_to_print
20+
return None

0 commit comments

Comments
 (0)