Fixed a bug that was causing graphql_schmea command to not import properly

This commit is contained in:
BossGrand 2016-09-21 14:57:47 -07:00
parent bcb408f921
commit 1cb5f24f5b

View File

@ -57,8 +57,15 @@ class Command(CommandArguments):
def handle(self, *args, **options):
options_schema = options.get('schema')
if options_schema:
schema = importlib.import_module(options_schema)
if options_schema and type(options_schema) is str:
module_str, schema_name = options_schema.rsplit('.', 1)
mod = importlib.import_module(module_str)
schema = getattr(mod, schema_name)
elif options_schema:
schema = options_schema
else:
schema = graphene_settings.SCHEMA