예제 #1
0
def create_app(config_name):
    app = Flask(__name__)
    app.config.from_object(config[config_name])
    config[config_name].init_app(app)

    bootstrap.init_app(app)
    mail.init_app(app)
    moment.init_app(app)
    db.init_app(app)
    login_manager.init_app(app)
    GoogleMaps(app)

    from .main import main as main_blueprint
    app.register_blueprint(main_blueprint)

    from .auth import auth as auth_blueprint
    app.register_blueprint(auth_blueprint, url_prefix='/auth')

    return app
예제 #2
0
from flask import Flask
from flask.ext.googlemaps import GoogleMaps
app = Flask(__name__)
GoogleMaps(app)
예제 #3
0
import os
import json
from type_of_food import TypeOfFood
from food_survival import FoodSurvival
from storage_location import StorageLocation
from forecast import Forecast
from flask import Flask, render_template, request, g, session, url_for, redirect
from flask.ext.googlemaps import GoogleMaps

app = Flask(__name__)
GoogleMaps(app, key="AIzaSyDnDdKk8h8ipdZFyLMBeCUSbdPcShUNQjI")
UPLOAD_FOLDER = './static/uploads/'
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif', 'csv'])
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
app.secret_key = 'some key for session'


@app.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'POST':
        args = []
        args.append(request.form['firstname'])
        args.append(request.form['lastname'])
        return render_template('index.html', args=args)
    else:
        return render_template('index.html')


@app.route('/type_of_food', methods=['GET', 'POST'])
def type_of_food():
예제 #4
0
from flask import Flask, render_template,json, request
import requests
from flask.ext.googlemaps import GoogleMaps

ES_addr = 'http://ec2-35-160-188-74.us-west-2.compute.amazonaws.com:9200'

application = Flask(__name__)
GoogleMaps(application)

res_count = requests.get(ES_addr + '/twitter/tweets/_count')

count_json = json.loads(res_count.text)

@application.route('/',methods=['POST'])
def run2():
    

    dp_res = request.form['dropdown']
    selected = dp_res

    query = json.dumps({
        "size":5000,
        "query": {
            "match": {
                "text": dp_res
            }
        }
    })
    res_query = requests.get(ES_addr + '/twitter/tweets/_search?', data=query)