Exemplo n.º 1
0
def deploy(deploy_type):
    import os
    from flask.ext.migrate import upgrade
    from app.models import BlogInfo, User, ArticleTypeSetting, Source, \
        ArticleType, Plugin, BlogView, Comment

    # ADMIN SETTING
    ADMIN_EMAIL = os.environ.get('ADMIN_EMAIL') or "*****@*****.**"
    ADMIN_NAME = os.environ.get('ADMIN_NAME') or "admin"
    ADMIN_PASSWD = os.environ.get('ADMIN_PASSWD') or "admin"

    # upgrade database to the latest version
    upgrade()

    if deploy_type == 'product':
        # step_1:insert basic blog info
        BlogInfo.insert_blog_info()
        # step_2:insert admin account
        User.insert_admin(email=ADMIN_EMAIL,
                          username=ADMIN_NAME,
                          password=ADMIN_PASSWD)
        # step_3:insert system default setting
        ArticleTypeSetting.insert_system_setting()
        # step_4:insert default article sources
        Source.insert_sources()
        # step_5:insert default articleType
        Menu.insert_menus()
        ArticleType.insert_system_articleType()
        ArticleType.insert_articleTypes()
        # step_6:insert system plugin
        Plugin.insert_system_plugin()
        # step_7:insert blog view
        BlogView.insert_view()
Exemplo n.º 2
0
def deploy(deploy_type):
    from flask.ext.migrate import upgrade
    from app.models import BlogInfo, User, ArticleTypeSetting, Source, \
        ArticleType, Plugin, BlogView, Comment

    # upgrade database to the latest version
    upgrade()

    if deploy_type == 'product':
        # step_1:insert basic blog info
        BlogInfo.insert_blog_info()
        # step_2:insert admin account
        User.insert_admin(email='*****@*****.**',
                          username='******',
                          password='******')
        User.insert_admin(email='*****@*****.**',
                          username='******',
                          password='******')
        User.insert_admin(email='*****@*****.**',
                          username='******',
                          password='******')
        User.insert_admin(email='*****@*****.**',
                          username='******',
                          password='******')
        # step_3:insert system default setting
        ArticleTypeSetting.insert_system_setting()
        # step_4:insert default article sources
        Source.insert_sources()
        # step_5:insert default articleType
        ArticleType.insert_system_articleType()
        # step_6:insert system plugin
        Plugin.insert_system_plugin()
        # step_7:insert blog view
        BlogView.insert_view()

    # You must run `python manage.py deploy(product)` before run `python manage.py deploy(test_data)`
    if deploy_type == 'test_data':
        # step_1:insert navs
        Menu.insert_menus()
        # step_2:insert articleTypes
        ArticleType.insert_articleTypes()
        # step_3:generate random articles
        Article.generate_fake(100)
        # step_4:generate random comments
        Comment.generate_fake(300)
        # step_5:generate random replies
        Comment.generate_fake_replies(100)
        # step_4:generate random comments
        Comment.generate_fake(300)
Exemplo n.º 3
0
def deploy(deploy_type):
    from flask.ext.migrate import upgrade
    from app.models import User, \
        ArticleType, Plugin, Js, DriverType
    # upgrade database to the latest version
    upgrade()
    if deploy_type == 'product':
        Role.insert_roles()
        ArticleType.insert_articleTypes()
        # step_2:insert admin account
        User.insert_admin(email='*****@*****.**',
                          username='******',
                          password='******')
        User.insert_admin(email='*****@*****.**',
                          username='******',
                          password='******')
        Plugin.insert_system_plugin()
        Js.insert_js()
        DriverType.insert_driverTypes()
Exemplo n.º 4
0
def deploy(deploy_type):
    from flask.ext.migrate import upgrade
    from app.models import BlogInfo, User, ArticleTypeSetting, Source, \
        ArticleType, Plugin, BlogView, Comment

    # upgrade database to the latest version
    upgrade()

    if deploy_type == 'product':
        # step_1:insert basic blog info
        BlogInfo.insert_blog_info()
        # step_2:insert admin account
        User.insert_admin(email='*****@*****.**',
                          username='******',
                          password='******')
        # step_3:insert system default setting
        ArticleTypeSetting.insert_system_setting()
        # step_4:insert default article sources
        Source.insert_sources()
        # step_5:insert default articleType
        ArticleType.insert_system_articleType()
        # step_6:insert system plugin
        Plugin.insert_system_plugin()
        # step_7:insert blog view
        BlogView.insert_view()

    # You must run `python manage.py deploy(product)` before run `python manage.py deploy(test_data)`
    if deploy_type == 'test_data':
        # step_1:insert navs
        Menu.insert_menus()
        # step_2:insert articleTypes
        ArticleType.insert_articleTypes()
        # step_3:generate random articles
        Article.generate_fake(100)
        # step_4:generate random comments
        Comment.generate_fake(300)
        # step_5:generate random replies
        Comment.generate_fake_replies(100)
        # step_4:generate random comments
        Comment.generate_fake(300)
Exemplo n.º 5
0
def deploy(deploy_type):
    from flask.ext.migrate import upgrade
    from app.models import BlogInfo, User, ArticleTypeSetting, Source, \
        ArticleType, Plugin, BlogView, Comment

    # upgrade database to the latest version
    upgrade()

    if deploy_type == 'product':
        # step_1:insert basic blog info
        BlogInfo.insert_blog_info()
        # step_2:insert admin account
        User.insert_admin(email='*****@*****.**', username='******', password='******', userlevel='admin')
        # step_3:insert system default setting
        ArticleTypeSetting.insert_system_setting()
        # step_4:insert default article sources
        Source.insert_sources()
        # step_5:insert default articleType
        ArticleType.insert_system_articleType()
        # step_6:insert system plugin
        Plugin.insert_system_plugin()
        # step_7:insert blog view
        BlogView.insert_view()

    # You must run `python manage.py deploy(product)` before run `python manage.py deploy(test_data)`
    if deploy_type == 'test_data':
        # step_1:insert navs
        Menu.insert_menus()
        # step_2:insert articleTypes
        ArticleType.insert_articleTypes()
        # step_3:generate random articles
        Article.generate_fake(100)
        # step_4:generate random comments
        Comment.generate_fake(300)
        # step_5:generate random replies
        Comment.generate_fake_replies(100)
        # step_4:generate random comments
        Comment.generate_fake(300)
Exemplo n.º 6
0
def deploy(deploy_type):
    from flask.ext.migrate import upgrade
    from app.models import BlogInfo, User, ArticleTypeSetting, Source, \
        ArticleType, Plugin, BlogView, Comment

    # upgrade database to the latest version
    upgrade()

    if deploy_type == 'product':
        BlogInfo.insert_blog_info()
        User.insert_admin(email='*****@*****.**',
                          username='******',
                          password='******')
        ArticleTypeSetting.insert_system_setting()
        Source.insert_sources()
        ArticleType.insert_system_articleType()
        Plugin.insert_system_plugin()
        BlogView.insert_view()

        # You must run `python manage.py deploy(product)` before run `python manage.py deploy(test_data)`
    if deploy_type == 'test_data':
        Menu.insert_menus()
        ArticleType.insert_articleTypes()
Exemplo n.º 7
0
def deploy():
    #User.insert_admin(email='*****@*****.**', username='******', password='******')
    ArticleType.insert_articleTypes()
    Article.generate_fake(100)