Skip to content

Commit

Permalink
Display error messages from click
Browse files Browse the repository at this point in the history
It turns out that django-click doesn't handle exceptions in the way we'd
expect. As a stop-gap, print them as `click` would
  • Loading branch information
CM Lubinski committed Aug 10, 2016
1 parent 65388be commit 62fb514
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@
import os
import sys

from click import ClickException


def main(argv):
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"regparser.web.settings.dev")

from django.core.management import execute_from_command_line

execute_from_command_line(argv)
try:
execute_from_command_line(argv)
except ClickException as e:
e.show()
sys.exit(e.exit_code)


if __name__ == "__main__":
Expand Down

0 comments on commit 62fb514

Please sign in to comment.