Skip to content

Commit 0130252

Browse files
authored
Merge pull request #94 from flask-extensions/poetry
Moving to Poetry
2 parents f9e5591 + 0acb7de commit 0130252

File tree

13 files changed

+908
-66
lines changed

13 files changed

+908
-66
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ media/*
4242
.project
4343
.pydevproject
4444
venv
45+
.secrets.*

README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# Flask Google Maps
22

3-
[![Flask Registered](https://img.shields.io/badge/flask-registered-green.svg?style=flat)](https://github.com/pocoo/metaflask)
3+
[![Flask Estension](https://img.shields.io/badge/flask-extension-green.svg?style=flat)](https://flaskextensions.com)
44
<a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;business=rochacbruno%40gmail%2ecom&amp;lc=BR&amp;item_name=FlaskGoogleMaps&amp;no_note=0&amp;currency_code=USD&amp;bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest"><img alt='Donate with Paypal' src='http://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif' /></a>
55

66
Easy to use Google Maps in your Flask application
77

8-
Look the Live DEMO: http://flaskgooglemaps.pythonanywhere.com
9-
108
## requires
119

1210
- Jinja
@@ -269,23 +267,33 @@ def map_bounded():
269267
### Run the example app
270268

271269
```bash
272-
273-
$ git clone https://github.com/rochacbruno/Flask-GoogleMaps
270+
$ git clone https://github.com/flask-extensions/Flask-GoogleMaps
274271
$ cd Flask-GoogleMaps/
275-
$ python setup.py develop
276-
$ cd examples/
277-
$ python example.py
278-
running..
272+
```
273+
274+
If you have Poetry
279275

276+
```bash
277+
$ poetry install
280278
```
281279

282-
Access: http://localhost:5000/ and http://localhost:5000/fullmap
280+
without poetry
281+
282+
```bash
283+
$ pip install --upgrade pip
284+
$ pip install -e .
285+
$ pip install -r requirements.txt
286+
```
283287

284-
### TODO (open a Pull Request)
288+
Run it.
285289

286-
Implement other methods from the api, add layers etc...
290+
```bash
291+
$ FLASK_GOOGLEMAPS_KEY="YourKeyHERE" FLASK_APP=examples/example.py flask run
292+
running on localhost:5000 .....
293+
```
287294

288-
Please see this page [developers.google.com/maps/documentation/javascript/tutorial](https://developers.google.com/maps/documentation/javascript/tutorial) and contribute!
295+
Access: http://localhost:5000/ and http://localhost:5000/fullmap
289296

290-
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rochacbruno/flask-googlemaps/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
297+
## Contribute
291298

299+
Please see this page [developers.google.com/maps/documentation/javascript/tutorial](https://developers.google.com/maps/documentation/javascript/tutorial) and contribute!

examples/example.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
from flask import Flask, render_template, request
44
from flask_googlemaps import GoogleMaps
55
from flask_googlemaps import Map, icons
6+
from dynaconf import FlaskDynaconf
67

78
app = Flask(__name__, template_folder="templates")
9+
FlaskDynaconf(app) # will read GOOGLEMAPS_KEY from .secrets.toml
10+
811

912
# you can set key as config
1013
#app.config['GOOGLEMAPS_KEY'] = "AIzaSyDP0GX-Wsui9TSDxtFNj2XuKrh7JBTPCnU"

examples/example_of_a.secrets.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[default]
2+
GOOGLEMAPS_KEY = "AIzaSyASoiiR2llCxCroz6Mj060q18e_893475348957"

examples/simple.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from flask import Flask, render_template
2+
from flask_googlemaps import GoogleMaps, Map, icons
3+
from dynaconf import FlaskDynaconf
4+
5+
app = Flask(__name__)
6+
GoogleMaps(app)
7+
FlaskDynaconf(app)
8+
9+
10+
@app.route("/")
11+
def map_created_in_view():
12+
13+
gmap = Map(
14+
identifier="gmap",
15+
varname="gmap",
16+
lat=37.4419,
17+
lng=-122.1419,
18+
markers={
19+
icons.dots.green: [(37.4419, -122.1419), (37.4500, -122.1350)],
20+
icons.dots.blue: [(37.4300, -122.1400, "Hello World")]
21+
},
22+
style="height:400px;width:600px;margin:0;"
23+
)
24+
25+
return render_template("simple.html", gmap=gmap)
26+
27+
28+
if __name__ == "__main__":
29+
app.run()

examples/templates/example.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
{{pgonmap.js}}
1717
{{collapsible.js}}
1818
{{infoboxmap.js}}
19-
{{clickmap.js}}
19+
{{clickmap.js}}
2020

2121
</head>
2222
<body>
2323
<h1>Flask Google Maps Example</h1>
2424

2525
Provide your Google Maps API Key to test it.
26-
Get you APIKEY in <a href="https://cloud.google.com/maps-platform/?apis=maps">https://cloud.google.com/maps-platform/?apis=maps</a>
26+
Get you APIKEY in <a href="https://console.developers.google.com/">https://console.developers.google.com/</a><br>
27+
NOTE: You need to create an APIKEY and also activate Maps Javascript API for it.
2728
<form action="." method="GET">
2829
<input type="text" name="apikey" id="apikey"/><input type="submit" value="load"/>
2930
</form>
@@ -136,7 +137,7 @@ <h2>Cluster markes by proximity</h2>
136137

137138
{% endraw %}
138139
</pre>
139-
</code>
140+
</code>
140141

141142

142143

examples/templates/simple.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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.0">
6+
<title>Document</title>
7+
{{ gmap.js }}
8+
</head>
9+
<body>
10+
{{ gmap.html }}
11+
</body>
12+
</html>

flask_googlemaps/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""FlaskGoogleMaps - Google Maps Extension for Flask"""
22

3-
__version__ = '0.2.6'
3+
__version__ = '0.3.0'
44

55
from flask import render_template, Blueprint, Markup, g
66
from flask_googlemaps.icons import dots

flit.ini

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)