def setupLog(self): from warnings import filterwarnings filterwarnings("ignore", category=DeprecationWarning, module="logging") if self.options.config: logging.fileConfig(self.options.config) else: hdlr = logging.FileHandler(self.options.filelog) fmt = logging.Formatter("%(asctime)s %(levelname)s %(message)s") hdlr.setFormatter(fmt) logging.getLogger().addHandler(hdlr) logging.getLogger().setLevel(logging.INFO)
def configure_logging(configfile): logging.fileConfig(configfile) logging.addLevelName(TRACE, 'TRACE')
sys_path = list(sys.path) try: import appengine_monkey except ImportError: pass module_name, obj_name = APP_NAME.split(':', 1) __import__(module_name) module = sys.modules[module_name] application = getattr(module, obj_name) if os.environ['SERVER_SOFTWARE'].startswith('Development'): config_args = DEV_APP_ARGS config_kwargs = DEV_APP_KWARGS else: config_args = APP_ARGS config_kwargs = APP_KWARGS if config_args is not None or config_kwargs is not None: application = application(*(config_args or ()), **(config_kwargs or {})) logging_ini = os.path.join(os.path.dirname(__file__), 'logging.ini') if os.path.exists(logging_ini): import logging logging.fileConfig(logging_ini) def main(): sys.path[:] = sys_path run_wsgi_app(application) if __name__ == '__main__': main()
USE_TWOPHASE = False from alembic import context from sqlalchemy import engine_from_config, pool import re import sys import logging logging.fileConfig(options.config_file) # gather section names referring to different # databases. These are named "engine1", "engine2" # in the sample .ini file. db_names = options.get_main_option('databases') # add your model's MetaData objects here # for 'autogenerate' support. These must be set # up to hold just those tables targeting a # particular database. table.tometadata() may be # helpful here in case a "copy" of # a MetaData is needed. # from myapp import mymodel # target_metadata = { # 'engine1':mymodel.metadata1, # 'engine2':mymodel.metadata2 #} target_metadata = {} def run_migrations_offline(): """Run migrations in 'offline' mode.
USE_TWOPHASE = False from alembic import context from sqlalchemy import engine_from_config, pool import re import sys import logging logging.fileConfig(options.config_file) # gather section names referring to different # databases. These are named "engine1", "engine2" # in the sample .ini file. db_names = options.get_main_option('databases') # add your model's MetaData objects here # for 'autogenerate' support. These must be set # up to hold just those tables targeting a # particular database. table.tometadata() may be # helpful here in case a "copy" of # a MetaData is needed. # from myapp import mymodel # target_metadata = { # 'engine1':mymodel.metadata1, # 'engine2':mymodel.metadata2 #} target_metadata = {} def run_migrations_offline():