コード例 #1
0
def clean_db():
    """Clean DB."""
    from flask_sqlalchemy import SQLAlchemy

    from admin import create_app
    from admin.keycloak import Keycloak
    from tests.fake_oidc import FakeOidc

    Keycloak._oidc = FakeOidc()
    app = create_app(run_mode='testing')

    db = SQLAlchemy(app)

    return db
コード例 #2
0
ファイル: wsgi.py プロジェクト: stevenc987/sbc-pay
# Copyright © 2019 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Provides the WSGI entry point for running the application
"""
from admin import create_app
import sys


# Openshift s2i expects a lower case name of application
application = create_app()  # pylint: disable=invalid-name

if __name__ == "__main__":
    port = '8080'
    if len(sys.argv) > 1:
        port = sys.argv[1]
    application.run(port=int(port), debug=True)
コード例 #3
0
ファイル: run.py プロジェクト: vickazy/sideka_app_server
from flask_login import login_user, login_required, logout_user, UserMixin
from sqlalchemy.orm import load_only, aliased
from sqlalchemy import func, desc, update
from sqlalchemy.sql.functions import concat

from phpserialize import *
from collections import OrderedDict
from common import PasswordHash
from models import *

import os
import json
import urllib
import datetime

app = create_app()
app.config['SQLALCHEMY_ECHO'] = True

phasher = PasswordHash(8, True)
login_manager = create_login_manager(app)


class User(UserMixin):
    pass


def get_user_by_nickname(nickname):
    user = db.session.query(WpUser)\
        .filter(WpUser.user_login == nickname)\
        .first()
    return user
コード例 #4
0
ファイル: crawler.py プロジェクト: juggle2729/python_pay
from admin import create_app
from db.bill.model import Bill
import query


def update_account_bill(delta=0):
    result = query.query_bill(delta)
    print(result)
    if not result:
        return

    for r in result:
        r = r.split(',')
        bill = Bill()
        bill.fill(r)
        custID = CustomID.query.filter(CustomID.custID == bill.channel_flag).first()
        if not custID:
            print('%r not belong to any registered user' % bill)
            return
        bill.belonged_account = custID.account
        bill.save()


if __name__ == '__main__':
    delta = 0
    app = create_app('default')
    if len(sys.argv) > 1:
        delta = int(sys.argv[1])
    with app.app_context():
        update_account_bill(delta)
コード例 #5
0
 def create_app(self):
     app = create_app()
     app.config.from_object('admin.config.TestingConfig')
     return app