Commit 22dc8526 authored by Kevin Morris's avatar Kevin Morris
Browse files

move off env.py's active code to __name__ == "__main__"



* Moved migrations/env.py's logging initialization and migration execution
  into a `__name__ == "__main__"` stanza so it doesn't immediately happen
  when imported by another module.
Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
parent 79cb7632
......@@ -11,10 +11,6 @@ import aurweb.schema
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
logging.config.fileConfig(config.config_file_name)
# model MetaData for autogenerating migrations
target_metadata = aurweb.schema.metadata
......@@ -68,7 +64,12 @@ def run_migrations_online():
context.run_migrations()
if context.is_offline_mode():
if __name__ == "__main__":
# Interpret the config file for Python logging.
# This line sets up loggers basically.
logging.config.fileConfig(config.config_file_name)
if context.is_offline_mode():
run_migrations_offline()
else:
else:
run_migrations_online()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment