changeset 379:8fb643ea7982 0.6.4

runtasks: Give more info if Celery is not installed.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 24 Sep 2015 21:41:41 -0700
parents 436f9b54d3e1
children 07cf1f95696f
files wikked/tasks.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/wikked/tasks.py	Thu Sep 24 21:26:56 2015 -0700
+++ b/wikked/tasks.py	Thu Sep 24 21:41:41 2015 -0700
@@ -1,11 +1,18 @@
 import logging
-from celery import Celery
 from wikked.wiki import Wiki, WikiParameters, BACKGROUND_CONTEXT
 
 
 logger = logging.getLogger(__name__)
 
 
+try:
+    from celery import Celery
+except ImportError:
+    logger.error("Celery is needed to run background tasks.")
+    logger.error("Install it with: pip install celery")
+    raise
+
+
 logger.debug("Creating Celery application...")
 celery_app = Celery('wikked', include=['wikked.tasks'])