Skip to content

Commit

Permalink
Merge pull request #94 from flask-extensions/poetry
Browse files Browse the repository at this point in the history
Moving to Poetry
  • Loading branch information
Riverfount authored Feb 21, 2020
2 parents f9e5591 + 0acb7de commit 0130252
Show file tree
Hide file tree
Showing 13 changed files with 908 additions and 66 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ media/*
.project
.pydevproject
venv
.secrets.*
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Flask Google Maps

[![Flask Registered](https://img.shields.io/badge/flask-registered-green.svg?style=flat)](https://github.com/pocoo/metaflask)
[![Flask Estension](https://img.shields.io/badge/flask-extension-green.svg?style=flat)](https://flaskextensions.com)
<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>

Easy to use Google Maps in your Flask application

Look the Live DEMO: http://flaskgooglemaps.pythonanywhere.com

## requires

- Jinja
Expand Down Expand Up @@ -269,23 +267,33 @@ def map_bounded():
### Run the example app

```bash

$ git clone https://github.com/rochacbruno/Flask-GoogleMaps
$ git clone https://github.com/flask-extensions/Flask-GoogleMaps
$ cd Flask-GoogleMaps/
$ python setup.py develop
$ cd examples/
$ python example.py
running..
```

If you have Poetry

```bash
$ poetry install
```

Access: http://localhost:5000/ and http://localhost:5000/fullmap
without poetry

```bash
$ pip install --upgrade pip
$ pip install -e .
$ pip install -r requirements.txt
```

### TODO (open a Pull Request)
Run it.

Implement other methods from the api, add layers etc...
```bash
$ FLASK_GOOGLEMAPS_KEY="YourKeyHERE" FLASK_APP=examples/example.py flask run
running on localhost:5000 .....
```

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

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

Please see this page [developers.google.com/maps/documentation/javascript/tutorial](https://developers.google.com/maps/documentation/javascript/tutorial) and contribute!
3 changes: 3 additions & 0 deletions examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
from flask import Flask, render_template, request
from flask_googlemaps import GoogleMaps
from flask_googlemaps import Map, icons
from dynaconf import FlaskDynaconf

app = Flask(__name__, template_folder="templates")
FlaskDynaconf(app) # will read GOOGLEMAPS_KEY from .secrets.toml


# you can set key as config
#app.config['GOOGLEMAPS_KEY'] = "AIzaSyDP0GX-Wsui9TSDxtFNj2XuKrh7JBTPCnU"
Expand Down
2 changes: 2 additions & 0 deletions examples/example_of_a.secrets.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default]
GOOGLEMAPS_KEY = "AIzaSyASoiiR2llCxCroz6Mj060q18e_893475348957"
29 changes: 29 additions & 0 deletions examples/simple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from flask import Flask, render_template
from flask_googlemaps import GoogleMaps, Map, icons
from dynaconf import FlaskDynaconf

app = Flask(__name__)
GoogleMaps(app)
FlaskDynaconf(app)


@app.route("/")
def map_created_in_view():

gmap = Map(
identifier="gmap",
varname="gmap",
lat=37.4419,
lng=-122.1419,
markers={
icons.dots.green: [(37.4419, -122.1419), (37.4500, -122.1350)],
icons.dots.blue: [(37.4300, -122.1400, "Hello World")]
},
style="height:400px;width:600px;margin:0;"
)

return render_template("simple.html", gmap=gmap)


if __name__ == "__main__":
app.run()
7 changes: 4 additions & 3 deletions examples/templates/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
{{pgonmap.js}}
{{collapsible.js}}
{{infoboxmap.js}}
{{clickmap.js}}
{{clickmap.js}}

</head>
<body>
<h1>Flask Google Maps Example</h1>

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

{% endraw %}
</pre>
</code>
</code>



Expand Down
12 changes: 12 additions & 0 deletions examples/templates/simple.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
{{ gmap.js }}
</head>
<body>
{{ gmap.html }}
</body>
</html>
2 changes: 1 addition & 1 deletion flask_googlemaps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""FlaskGoogleMaps - Google Maps Extension for Flask"""

__version__ = '0.2.6'
__version__ = '0.3.0'

from flask import render_template, Blueprint, Markup, g
from flask_googlemaps.icons import dots
Expand Down
18 changes: 0 additions & 18 deletions flit.ini

This file was deleted.

Loading

0 comments on commit 0130252

Please sign in to comment.