Rebase: Moved the whole structure down one directory depth.
This commit is contained in:
1
brewman/scripts/__init__.py
Normal file
1
brewman/scripts/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# package
|
||||
31
brewman/scripts/populate.py
Normal file
31
brewman/scripts/populate.py
Normal file
@ -0,0 +1,31 @@
|
||||
import os
|
||||
import sys
|
||||
import transaction
|
||||
|
||||
from sqlalchemy import engine_from_config
|
||||
|
||||
from pyramid.paster import (
|
||||
get_appsettings,
|
||||
setup_logging,
|
||||
)
|
||||
|
||||
from ..models import (
|
||||
DBSession,
|
||||
Base,
|
||||
)
|
||||
|
||||
def usage(argv):
|
||||
cmd = os.path.basename(argv[0])
|
||||
print('usage: %s <config_uri>\n'
|
||||
'(example: "%s development.ini")' % (cmd, cmd))
|
||||
sys.exit(1)
|
||||
|
||||
def main(argv=sys.argv):
|
||||
if len(argv) != 2:
|
||||
usage(argv)
|
||||
config_uri = argv[1]
|
||||
setup_logging(config_uri)
|
||||
settings = get_appsettings(config_uri)
|
||||
engine = engine_from_config(settings, 'sqlalchemy.')
|
||||
DBSession.configure(bind=engine)
|
||||
Base.metadata.create_all(engine)
|
||||
Reference in New Issue
Block a user