softheon_secret = os.environ['SOFTHEON_CLIENT_SECRET'] DB_HOST = "localhost" PORT = '5432' APP_PORT = 3000 DB_STRING = "postgres://%s:%s@%s:%s/stim" % (DB_USER, DB_PASS, DB_HOST, PORT) # print(DB_STRING) app = Flask(__name__) app.config.update(config) # app.config.from_object(os.environ['APP_SETTINGS']) app.config['SQLALCHEMY_DATABASE_URI'] = DB_STRING app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False apns_client = FlaskAPNS() apns_client.init_app(app) CORS(app) db = SQLAlchemy(app) db.create_all() predict = Predict() ns = NotificationService() softheon = Softheon(softheon_client, softheon_secret) @app.route('/') def hello(): return "Hello World!"
def add_bp(app_obj): modules_define = [ auth.app, login.app, wage.app, username.app, password.app, user.app, shiftcategory.app, notification.app, color.app, salary.app, usershift.app, table.app, comment.app, memo.app, company.app, shift.app, token.app, follow.app, export.app, search.app, analytics.app ] for bp_app in modules_define: app_obj.register_blueprint(bp_app) app = init_app() client = FlaskAPNS() client.init_app(app) admin_basic_auth = BasicAuth(app) migrate = Migrate(app, db) @app.route('/logout') def Logout(): raise AuthException('Successfully logged out.') @app.route('/') @app.route('/index') def index(): return 'This is index page'
from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_pushjack import FlaskAPNS from flask_pushjack import FlaskGCM from flask_apscheduler import APScheduler app = Flask(__name__) app.config.from_object('config') db = SQLAlchemy(app) # auto = Autodoc(app) clientapns = FlaskAPNS() clientapns.init_app(app) clientgcm = FlaskGCM() clientgcm.init_app(app) scheduler = APScheduler()
data = { "wifiAccessPoints": [ {"macAddress": ap.mac_address, "signalStrength": ap.signal, "channel": ap.channel} for ap in aps ] } res = requests.post(url, headers=headers, json=data) geo = res.json() return geo["location"]["lat"], geo["location"]["lng"] # App definition app = Flask(__name__) app.config.update(config) client = FlaskAPNS() client.init_app(app) @app.route("/") def hello(): return "Hello world!" @app.route("/loc") def loc(): lat, lng = find_geolocation() return "{} {}".format(lat, lng) @app.route("/nearby") def nearby():