示例#1
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
示例#2
0
from flask import Flask

from routes import init_api_routes

app = Flask(__name__, template_folder='template')
init_api_routes(app)

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')
from flask import Flask, json, Response
from flask_cors import CORS

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

from game import Game
from player import Player
from words import Word
from routes import init_api_routes
from Model import Model

db_string = 'postgres://*****:*****@ec2-54-225-76-201.compute-1.amazonaws.com:5432/d58h3832oj43d6'
db_engine = create_engine(db_string)
Model.metadata.create_all(db_engine)
db_session = sessionmaker(bind=db_engine)
session = db_session()
app = Flask(__name__)

init_api_routes(app, session)

app.config['SECRET_KEY'] = 'Hello from Krishna Karanam'
CORS(app)

if __name__ == '__main__':
    app.run()