Exemplo n.º 1
0
def init_database(dbid, dataset='minimal', autocommit=False):
    bootstrap_path = pkg.resource_filename('antioch.core.bootstrap', '%s.py' % dataset)
    
    bootstrap.load_python(connection, bootstrap_path)
    bootstrap.initialize_plugins(connection)

    return connection
Exemplo n.º 2
0
def init_database(dbid, dataset='minimal', autocommit=False):
    bootstrap_path = pkg.resource_filename('antioch.core.bootstrap',
                                           '%s.py' % dataset)

    bootstrap.load_python(connection, bootstrap_path)
    bootstrap.initialize_plugins(connection)

    return connection
Exemplo n.º 3
0
 def handle(self, bootstrap='default', *args, **config):
     if(bootstrap in builtin_templates):
         bootstrap_path = pkg.resource_filename('antioch.core.bootstrap', '%s.py' % bootstrap)
     else:
         bootstrap_path = bootstrap
     load_python(connection, bootstrap_path)
     initialize_plugins(connection)
     
Exemplo n.º 4
0
 def handle(self, bootstrap='default', *args, **config):
     if (bootstrap in builtin_templates):
         bootstrap_path = pkg.resource_filename('antioch.core.bootstrap',
                                                '%s.py' % bootstrap)
     else:
         bootstrap_path = bootstrap
     load_python(connection, bootstrap_path)
     initialize_plugins(connection)
Exemplo n.º 5
0
 def handle(self, template='default', *args, **config):
     if(template in builtin_templates):
         bootstrap_path = pkg.resource_filename('antioch.core.bootstrap', '%s.py' % template)
     else:
         bootstrap_path = template
     pool = dbapi.connect(settings.DB_URL)
     bootstrap.load_python(pool, bootstrap_path)
     bootstrap.initialize_plugins(pool)
     
Exemplo n.º 6
0
    except usage.UsageError, e:
        print config.getSynopsis()
        print config.getUsage()
        print e.args[0]
        sys.exit(1)

    if(config['schema-file']):
        schema_path = config['schema-file']
    else:
        schema_path = pkg.resource_filename('antioch.core.bootstrap', default_schema_path)
    schema_path = os.path.abspath(schema_path)

    if(config['bootstrap-file']):
        bootstrap_path = config['bootstrap-file']
    else:
        bootstrap_path = pkg.resource_filename('antioch.core.bootstrap', default_bootstrap_path % config['dataset-name'])
    bootstrap_path = os.path.abspath(bootstrap_path)
    
    if not(config['no-init']):
        bootstrap.initialize_database(config['with-psql'], config['db-url'], config['psql-args'], quiet=False)
    
    from django.core.management import call_command
    call_command('syncdb', interactive=False)
    call_command('migrate', interactive=False)
    
    pool = dbapi.connect(config['db-url'])
    bootstrap.load_python(pool, bootstrap_path)
    bootstrap.initialize_plugins(pool)

if(__name__ == '__main__'):
    main()