From 7608a2f8b667a1b8ef359865ed4df6c7c2f93c61 Mon Sep 17 00:00:00 2001 From: "Hallvord Reiar M. Steen" Date: Tue, 1 Dec 2015 18:24:55 +0100 Subject: [PATCH] Print a more helpful error if there is not config.py file, #841 --- run.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/run.py b/run.py index 0b64f6b04..98d0bb253 100644 --- a/run.py +++ b/run.py @@ -18,10 +18,24 @@ ============================================== ''' +NO_CONF_ERROR = ''' +============================================== +The config.py file seems to be missing. + +Please create a copy of config.py.example and customize it accordingly. +For details, please see +https://github.com/webcompat/webcompat.com/blob/master/CONTRIBUTING.md#configuring-the-server +============================================== +''' + try: from webcompat import app except ImportError, e: - raise ImportError('{0}\n\n{1}'.format(e, IMPORT_ERROR)) + if e.import_name == 'config': + # config not found, somebody forgot to make a copy of config.py.example and modify? + raise ImportError('{0}\n\n{1}'.format(e, NO_CONF_ERROR)) + else: + raise ImportError('{0}\n\n{1}'.format(e, IMPORT_ERROR)) TOKEN_HELP = '''