Пример #1
0
def init(app):
    db.init_app(app)
    user = UserManager(app)
    user.init_wapis(wapi)
    user.init_web()
    wapi.init_app(app)
    media.init_app(app)

    @app.route("/test")
    def test():
        u = user.models.WeChatUser.objects(unionid="1223").first()
        login_user(u)
        return redirect(user.config.bind_url)
Пример #2
0
def init(app):
    um = UserManager(app)
    db.init_app(app)
    admin = Admin(name='Chiki', base_template='base.html')

    admin.category_icon_classes = {
        u'运营': 'fa fa-hdd-o',
        u'日志': 'fa fa-database',
    }

    admin.add_view(UserView(um.models.User, name='用户'))
    admin.add_view(WeChatUserView(um.models.WeChatUser, name='微信用户'))
    admin.add_view(QQUserView(um.models.QQUser, name='QQ用户'))
    admin.add_view(WeiBoUser(um.models.WeiBoUser, name='微博用户'))

    # 日志
    admin.add_view(ItemView(Item, name='系统选项', category='日志'))
    admin.add_view(StatLogView(StatLog, name='统计日志', category='日志'))
    admin.add_view(TraceLogView(TraceLog, name='跟踪日志', category='日志'))

    admin.add_view(UserLogView(um.models.UserLog, name='用户日志', category='日志'))
    admin.add_view(
        PhoneCodeView(um.models.PhoneCode, name='手机验证码', category='日志'))
    admin.add_view(
        EmailCodeView(um.models.EmailCode, name='邮箱验证码', category='日志'))

    admin.init_app(app)
Пример #3
0
def init(app):
    db.init_app(app)
    user = UserManager(app)
    user.init_wapis(wapi)
    user.init_web()
    wapi.init_app(app)
    media.init_app(app)

    @app.route('/test')
    def test():
        u = user.models.WeChatUser.objects(unionid='1212').first()
        if not u:
            u = user.models.WeChatUser(unionid='1212').save()
        login_user(u)
        return redirect(user.config.bind_url)


    @app.route('/')
    @login_required
    def index():
        return '123'
Пример #4
0
def init(app):
    db.init_app(app)
    user = UserManager(app)
    user.init_wapis(wapi)
    user.init_web()
    wapi.init_app(app)
    media.init_app(app)

    @app.route('/test')
    def test():
        u = user.models.WeChatUser.objects(unionid='1223').first()
        login_user(u)
        return redirect(user.config.bind_url)
Пример #5
0
def init(app):
    um = UserManager(app)
    db.init_app(app)
    um.init_apis(api)
    api.init_app(app)
Пример #6
0
def init(app):
    user = UserManager(app)
    user.init_apis(api)
    api.init_app(app)
Пример #7
0
# coding: utf-8
from chiki.mongoengine import MongoEngine
from chiki.contrib.users import UserManager
from chiki.api import api, wapi
from flask import Blueprint

from simple.config import BaseConfig

db = MongoEngine()
um = UserManager()
page = Blueprint('page', __name__)