コード例 #1
0
def flask_app():
    app = Flask(__name__)
    app.config['TESTING'] = True
    init_website_routes(app)
    with app.app_context():
        yield app
    my_rover.route_state = []
    my_rover.remark = ''  # reset after each testcase
コード例 #2
0
from flask import Flask, render_template, url_for, copy_current_request_context
from threading import Thread, Event

# Imports for Web Sockets
from threading import Lock
from Data_Ingestor.streaming import DataFlow
from Data_Ingestor.streaming import *

async_mode = None

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
app.config['DEBUG'] = True

init_api_routes(app)
init_website_routes(app)

#turn the flask app into a socketio app
socketio = SocketIO(app, async_mode=async_mode)

thread = None
thread_lock = Lock()
flow = None


def background_thread():
    print("background thread")
    global flow
    print("Stream is flowing...")
    flow = DataFlow.factory('historical')
    flow.start(socketio)
コード例 #3
0
from flask import Flask

from routes import init_api_routes
from routes import init_website_routes


# create the Flask application
app = Flask(__name__)

init_api_routes(app)
init_website_routes(app)


#
# Template filters
#
@app.template_filter('senior_candidate')
def senior_candidate(candidates):
    result = []
    for candidate in candidates:
        for experience in candidate['experience']:
            if experience['years'] >= 5:
                result.append({
                    'first_name':candidate['first_name'],
                    'last_name':candidate['last_name'],
                    'years':experience['years'],
                    'domain':experience['domain']
                })
                break

    return result
コード例 #4
0
ファイル: app.py プロジェクト: danielmcheng1/drone
from flask import Flask
import routes
app = Flask(__name__)

app.config['SECRET_KEY'] = 'Hello from the secret world of Flask! ;)'

#init_api_routes(app)
routes.init_website_routes(app)
#init_error_handlers(app)

if __name__ == "__main__":
    app.run(debug=True)