当前位置: 首页>>代码示例>>Python>>正文


Python manage.make_simple_application函数代码示例

本文整理汇总了Python中uliweb.manage.make_simple_application函数的典型用法代码示例。如果您正苦于以下问题:Python make_simple_application函数的具体用法?Python make_simple_application怎么用?Python make_simple_application使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了make_simple_application函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

 def handle(self, options, global_options, *args):
     from uliweb.utils.common import extract_dirs
     from uliweb.core.template import template_file
     from uliweb.manage import make_simple_application
     from uliweb import settings
     from sqlalchemy import create_engine, MetaData, Table
     from shutil import rmtree
     from uliweb.orm import get_connection, engine_manager
     
     alembic_path = os.path.join(global_options.project, 'alembic', options.engine).replace('\\', '/')
     #delete alembic path
     if os.path.exists(alembic_path):
         rmtree(alembic_path, True)
     extract_dirs('uliweb.contrib.orm', 'templates/alembic', alembic_path, 
         verbose=global_options.verbose, replace=True)
     make_simple_application(project_dir=global_options.project,
         settings_file=global_options.settings,
         local_settings_file=global_options.local_settings)
     ini_file = os.path.join(alembic_path, 'alembic.ini')
     text = template_file(ini_file, 
         {'connection':engine_manager[options.engine].options.connection_string, 
         'engine_name':options.engine,
         'script_location':alembic_path})
     
     with open(ini_file, 'w') as f:
         f.write(text)
         
     #drop old alembic_version table
     db = get_connection(engine_name=options.engine)
     metadata = MetaData(db)
     if db.dialect.has_table(db.connect(), 'alembic_version'):
         version = Table('alembic_version', metadata, autoload=True) 
         version.drop()
开发者ID:chifeng,项目名称:uliweb,代码行数:33,代码来源:subcommands.py

示例2: run_migrations_online

def run_migrations_online():
    """Run migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.
    
    """
    from uliweb.manage import make_simple_application
    from uliweb import orm, settings

#    engine = engine_from_config(
#                config.get_section(config.config_ini_section), 
#                prefix='sqlalchemy.', 
#                poolclass=pool.NullPool)

    name = config.get_main_option("engine_name")
    make_simple_application(project_dir='.')
    target_metadata = orm.get_metadata(name)
    connection = orm.get_connection(engine_name=name).connect()
#    connection = engine.connect()
    
    context.configure(
                connection=connection, 
                target_metadata=target_metadata,
                compare_server_default=True,
                include_object=uliweb_include_object,
#                compare_server_default=uliweb_compare_server_default,
                )

    try:
        with context.begin_transaction():
            context.run_migrations()
    finally:
        connection.close()
开发者ID:08haozi,项目名称:uliweb,代码行数:34,代码来源:env.py

示例3: handle

 def handle(self, options, global_options, *args):
     from uliweb.manage import make_simple_application
     from uliweb import orm
     from getpass import getpass
     
     app = make_simple_application(apps_dir=global_options.apps_dir, 
         settings_file=global_options.settings, local_settings_file=global_options.local_settings)
     db = orm.get_connection()
     
     username = ''
     while not username:
         username = raw_input("Please enter the super user's name: ")
     email = ''
     while not email:
         email = raw_input("Please enter the email of [%s]: " % username)
         
     password = ''
     while not password:
         password = getpass("Please enter the password for [%s(%s)]: " % (username, email))
     repassword = ''
     while not repassword:
         repassword = getpass("Please enter the password again: ")
     
     if password != repassword:
         print "The password is not matched, can't create super user!"
         return
     
     orm.set_dispatch_send(False)
     
     User = orm.get_model('user', options.engine)
     user = User(username=username, email=email)
     user.set_password(password)
     user.is_superuser = True
     user.save()
开发者ID:28sui,项目名称:uliweb,代码行数:34,代码来源:commands.py

示例4: get_application

 def get_application(self, global_options):
     from uliweb.manage import make_simple_application
     
     return make_simple_application(project_dir=global_options.project, 
         settings_file=global_options.settings, 
         local_settings_file=global_options.local_settings
         )
开发者ID:tangjn,项目名称:uliweb,代码行数:7,代码来源:commands.py

示例5: get_app

def get_app(project_path=".", settings_file="settings.ini", local_settings_file="local_settings.ini"):
    from uliweb.manage import make_simple_application

    app = make_simple_application(
        project_dir=project_path, settings_file=settings_file, local_settings_file=local_settings_file
    )
    return app
开发者ID:RiverLiu,项目名称:uliweb,代码行数:7,代码来源:test.py

示例6: setup

def setup():
    import os
    global _path
    _path = os.getcwd()
    locate_dir = os.path.dirname(__file__)
    os.chdir(os.path.abspath(locate_dir))
    os.chdir('test_project')

    from uliweb.manage import make_simple_application
    app = make_simple_application(apps_dir='./apps')         
开发者ID:chu888chu888,项目名称:Python--uliweb-redbreast,代码行数:10,代码来源:test_pymysql.py

示例7: get_application

    def get_application(self, global_options, default_settings=None):
        from uliweb.manage import make_simple_application

        app = make_simple_application(project_dir=global_options.project,
            settings_file=global_options.settings, 
            local_settings_file=global_options.local_settings,
            default_settings=default_settings
            )
        from uliweb import application
        return application
开发者ID:28sui,项目名称:uliweb,代码行数:10,代码来源:commands.py

示例8: setup

    def setup(self):
        import os
        self._path = os.getcwd()

        locate_dir = os.path.dirname(__file__)
        os.chdir(os.path.abspath(locate_dir))
        os.chdir('test_project')
        self.create_database()

        from uliweb.manage import make_simple_application
        app = make_simple_application(apps_dir='./apps')        
开发者ID:chu888chu888,项目名称:Python--uliweb-redbreast,代码行数:11,代码来源:test_performace.py

示例9: init

def init():
    setup()
    manage.call('uliweb makeproject --yes TestProject')
    os.chdir('TestProject')
    path = os.getcwd()
    manage.call('uliweb makeapp Test')
    f = open('apps/Test/models.py', 'w')
    f.write('''
from uliweb.orm import *

class User(Model):
    username = Field(str)
    birth = Field(datetime.date)
    email =Field(str)
    
class Group(Model):
    name = Field(str)
    members = ManyToMany('user')
    manager = Reference('user')
    
class Blog(Model):
    sid = Field(str)
    subject = Field(str)
''')
    f.close()
    f = open('apps/settings.ini', 'w')
    f.write('''
[GLOBAL]
INSTALLED_APPS = [
'uliweb.contrib.redis_cli', 
'uliweb.contrib.orm', 
'uliweb.contrib.objcache', 
'Test'
]

[LOG]
level = 'info'

[LOG.Loggers]
uliweb.contrib.objcache = {'level':'info'}

[MODELS]
user = 'Test.models.User'
group = 'Test.models.Group'
blog = 'Test.models.Blog'

[OBJCACHE_TABLES]
user = 'username', 'email'
group = 'name'
blog = {'key':'sid'}
''')
    f.close()
    manage.call('uliweb syncdb')
    app = manage.make_simple_application(project_dir=path)
开发者ID:28sui,项目名称:uliweb,代码行数:54,代码来源:test_cache_obj.py

示例10: call

def call(args, options, global_options):
    app = make_simple_application(apps_dir=global_options.apps_dir)

    Begin()
    try:
        process()
        Commit()
    except:
        Rollback()
        import traceback

        traceback.print_exc()
开发者ID:naomhan,项目名称:uliweb-peafowl,代码行数:12,代码来源:import_dashboard_mock_data.py

示例11: get_engine

def get_engine(options, global_options):
    from uliweb.manage import make_simple_application
    settings = {'ORM/DEBUG_LOG':False, 'ORM/AUTO_CREATE':False, 'ORM/AUTO_DOTRANSACTION':False}
    app = make_simple_application(apps_dir=global_options.apps_dir, 
        settings_file=global_options.settings, 
        local_settings_file=global_options.local_settings,
        default_settings=settings)
    #because set_auto_set_model will be invoked in orm initicalization, so
    #below setting will be executed after Dispatcher started
    set_auto_set_model(True)
    engine_name = options.engine
    engine = get_connection(engine_name=engine_name)
    return engine
开发者ID:tangjn,项目名称:uliweb,代码行数:13,代码来源:commands.py

示例12: setup

    def setup(self):
        locate_dir = os.path.dirname(__file__)
        os.chdir(locate_dir)
        os.chdir('test_project')

        import shutil
        shutil.rmtree('database.db', ignore_errors=True)

        manage.call('uliweb syncdb')
        manage.call('uliweb syncspec')

        from uliweb.manage import make_simple_application
        app = make_simple_application(apps_dir='./apps')
开发者ID:chu888chu888,项目名称:Python--uliweb-redbreast,代码行数:13,代码来源:test_core_utils.py

示例13: handle

    def handle(self, options, global_options, *args):
        from alembic.config import Config
        from uliweb.orm import engine_manager
        from uliweb.manage import make_simple_application
        
        app = make_simple_application(apps_dir=global_options.apps_dir, 
            settings_file=global_options.settings, local_settings_file=global_options.local_settings)

        alembic_path = os.path.join(global_options.project, 'alembic', options.engine).replace('\\', '/')
        configfile = os.path.join(alembic_path, 'alembic.ini')
        alembic_cfg = Config(configfile)
        alembic_cfg.set_main_option("sqlalchemy.url", engine_manager[options.engine].options.connection_string)
        alembic_cfg.set_main_option("engine_name", options.engine)
        alembic_cfg.set_main_option("script_location", alembic_path)
        self.do(alembic_cfg, args, options, global_options)
开发者ID:chirive,项目名称:uliweb,代码行数:15,代码来源:subcommands.py

示例14: setup

    def setup(self):
        
        import os
        locate_dir = os.path.dirname(__file__)
        os.chdir(locate_dir)
        os.chdir('test_project')
        from uliweb.manage import make_simple_application
        app = make_simple_application(apps_dir='./apps')

        spec_dir = "test_project/apps/specapp/workflow_specs/"
        
        CoreWFManager.reset()
        storage = WFConfigStorage()
        config_file = join(dirname(__file__), spec_dir + "TestWorkflow.spec")
        storage.load_config_file(config_file)
        CoreWFManager.set_storage(storage)
开发者ID:chu888chu888,项目名称:Python--uliweb-redbreast,代码行数:16,代码来源:test_core_spec_storage.py

示例15: setup

    def setup(self):
        
        locate_dir = os.path.dirname(__file__)
        os.chdir(locate_dir)
        os.chdir('test_project')
        self.reset_database()
        manage.call('uliweb syncspec')
        self.path = os.getcwd()

        from uliweb.manage import make_simple_application
        app = make_simple_application(apps_dir='./apps')
        
        print app
        from uliweb import settings
        print settings.SPECS
        from redbreast.core.spec import WFDatabaseStorage
        
        CoreWFManager.reset()
开发者ID:chu888chu888,项目名称:Python--uliweb-redbreast,代码行数:18,代码来源:test_core_spec_manager_db.py


注:本文中的uliweb.manage.make_simple_application函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。