-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
31 lines (24 loc) · 1.03 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from flask import Flask, render_template, request,flash
from secrets import token_hex
from forms import geolocatethisForm
from geolocatethis import geo_locate_this
app = Flask(__name__)
app.config['SECRET_KEY'] = token_hex(16)
@app.route('/', methods=['GET', 'POST'])
def home():
form = geolocatethisForm(request.form)
if form.validate():
results = geo_locate_this(request.form['latitude'], request.form['longitude'],
request.form['radius'], request.form['keyword1'],
request.form['category1'], request.form['keyword2'],
request.form['category2'], request.form['distance'])
print("Console Debug: " + str(results))
for hit in results:
print(hit)
flash(hit)
else:
print(form.errors)
flash('There was an error submitting your request')
return render_template('index.html', title='GeoLocateThis Web Application', form=form)
if __name__ == '__main__':
app.run()