Skip to content

Commit 1cb5f24

Browse files
committed
Fixed a bug that was causing graphql_schmea command to not import properly
1 parent bcb408f commit 1cb5f24

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

graphene_django/management/commands/graphql_schema.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ def save_file(self, out, schema_dict):
5757

5858
def handle(self, *args, **options):
5959
options_schema = options.get('schema')
60-
if options_schema:
61-
schema = importlib.import_module(options_schema)
60+
61+
if options_schema and type(options_schema) is str:
62+
module_str, schema_name = options_schema.rsplit('.', 1)
63+
mod = importlib.import_module(module_str)
64+
schema = getattr(mod, schema_name)
65+
66+
elif options_schema:
67+
schema = options_schema
68+
6269
else:
6370
schema = graphene_settings.SCHEMA
6471

0 commit comments

Comments
 (0)