コード例 #1
0
def deploy():
    '''Run deployment tasks'''
    # migrate database to latest revision
    from flask_migrate import upgrade
    upgrade()

    verbose = False
    if app.debug:
        verbose_mode = input('Run in verbose mode? [yes/No]: ')
        if verbose_mode.lower() in ['y', 'yes']:
            verbose = True

    # insert data
    data = 'common'

    from app.models import Permission
    Permission.insert_entries(data=data, verbose=verbose)

    from app.models import Role
    Role.insert_entries(data=data, verbose=verbose)

    from app.models import Room
    Room.insert_entries(data=data, verbose=verbose)

    from app.models import DeviceType
    DeviceType.insert_entries(data=data, verbose=verbose)

    from app.models import LessonType
    LessonType.insert_entries(data=data, verbose=verbose)

    from app.models import Lesson
    Lesson.insert_entries(data=data, verbose=verbose)

    from app.models import Video
    Video.insert_entries(data=data, verbose=verbose)

    data = input(
        'Enter data identifier (e.g.: 20180805 or press the enter/return key for initial data): '
    )
    if data == '':
        data = 'initial'
    datadir = os.path.join(app.config['DATA_DIR'], data)
    if os.path.exists(datadir):
        from app.models import User
        User.insert_entries(data=data, verbose=verbose)

        from app.models import Punch
        Punch.insert_entries(data=data, verbose=verbose)

        from app.models import Device
        Device.insert_entries(data=data, verbose=verbose)

        from app.models import DeviceLessonType
        DeviceLessonType.insert_entries(data=data, verbose=verbose)

        from app.models import UserLog
        UserLog.insert_entries(data=data, verbose=verbose)
コード例 #2
0
ファイル: manage.py プロジェクト: cash2one/Y-System
def deploy():
    '''
    Run deployment tasks.
    '''

    # migrate database to latest revision
    from flask_migrate import upgrade
    upgrade()

    # insert data
    from app.models import Color
    Color.insert_entries()

    from app.models import Permission
    Permission.insert_entries()

    from app.models import Role
    Role.insert_entries()

    from app.models import IDType
    IDType.insert_entries()

    from app.models import Gender
    Gender.insert_entries()

    from app.models import Relationship
    Relationship.insert_entries()

    from app.models import PurposeType
    PurposeType.insert_entries()

    from app.models import ReferrerType
    ReferrerType.insert_entries()

    from app.models import BookingState
    BookingState.insert_entries()

    from app.models import AssignmentScoreGrade
    AssignmentScoreGrade.insert_entries()

    from app.models import GREAWScore
    GREAWScore.insert_entries()

    from app.models import ScoreLabel
    ScoreLabel.insert_entries()

    from app.models import InvitationType
    InvitationType.insert_entries()

    from app.models import EducationType
    EducationType.insert_entries()

    from app.models import ScoreType
    ScoreType.insert_entries()

    from app.models import CourseType
    CourseType.insert_entries()

    from app.models import iPadCapacity
    iPadCapacity.insert_entries()

    from app.models import iPadState
    iPadState.insert_entries()

    from app.models import Room
    Room.insert_entries()

    from app.models import Lesson
    Lesson.insert_entries()

    from app.models import Section
    Section.insert_entries()

    from app.models import Assignment
    Assignment.insert_entries()

    from app.models import Test
    Test.insert_entries()

    from app.models import AnnouncementType
    AnnouncementType.insert_entries()

    from config import basedir
    data = raw_input(u'Enter data identifier (e.g.: initial or 20160422): ')
    datadir = os.path.join(basedir, 'data', data)
    if os.path.exists(datadir):
        from app.models import User
        User.insert_entries(data=data, basedir=basedir)

        from app.models import UserCreation
        UserCreation.insert_entries(data=data, basedir=basedir)

        from app.models import Punch
        Punch.insert_entries(data=data, basedir=basedir)

        from app.models import Tag
        Tag.insert_entries(data='initial', basedir=basedir)

        from app.models import Product
        Product.insert_entries(data='initial', basedir=basedir)

        from app.models import Course
        Course.insert_entries(data='initial', basedir=basedir)

        from app.models import Period
        Period.insert_entries(data='initial', basedir=basedir)

        from app.models import iPad
        iPad.insert_entries(data='initial', basedir=basedir)

        from app.models import iPadContent
        iPadContent.insert_entries(data='initial', basedir=basedir)

        from app.models import NotaBene
        NotaBene.insert_entries(data='initial', basedir=basedir)

        from app.models import Feed
        Feed.insert_entries(data=data, basedir=basedir)
    else:
        print u'---> Invalid data identifier: %s' % data