Skip to content

Commit db0cf65

Browse files
committed
chore: show friendly message when config missing 'apps' section
1 parent 49bfbf4 commit db0cf65

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

aerich/cli.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ async def cli(ctx: Context, config, app) -> None:
6363
add_src_path(src_folder)
6464
tortoise_config = get_tortoise_config(ctx, tortoise_orm)
6565
if not app:
66-
apps_config = cast(dict, tortoise_config.get("apps"))
66+
try:
67+
apps_config = cast(dict, tortoise_config["apps"])
68+
except KeyError:
69+
raise UsageError('Config must define "apps" section')
6770
app = list(apps_config.keys())[0]
6871
command = Command(tortoise_config=tortoise_config, app=app, location=location)
6972
ctx.obj["command"] = command

0 commit comments

Comments
 (0)