Commits

Doug Latornell committed 3ede68e

Use celery directly rather than via pyramid_celery.

  • Participants
  • Parent commits ed6b8c9

Comments (0)

Files changed (4)

File development.ini

 pyramid.debug_routematch = false
 pyramid.default_locale_name = en
 pyramid.includes =
-    pyramid_celery
     pyramid_debugtoolbar
     pyramid_deform
     pyramid_mailer
 
 timezone = Canada/Pacific
 
-# celery configuration
-BROKER_URL = sqla+sqlite:///celerydb.sqlite
-
 [server:main]
 use = egg:waitress#main
 host = 0.0.0.0
 
 [program:smtpd]
 command = python -m smtpd -n -c DebuggingServer localhost:1025
-priority = 1
+redirect_stderr = true
 stdout_logfile = %(here)s/smtpd.log
 
+[program:celery]
+command = celery worker --config randopony.celery_config --loglevel info --autoreload
+redirect_stderr = true
+stdout_logfile = %(here)s/celery.log
+
 # End dev environment supervisord configuration
 
 

File randopony/__init__.py

+from celery import current_app as celery
 from pyramid.authentication import AuthTktAuthenticationPolicy
 from pyramid.config import Configurator
 from pyramid.security import ALL_PERMISSIONS
 from pyramid.security import Allow
 from sqlalchemy import engine_from_config
 from sqlalchemy.orm.exc import NoResultFound
+import celery_config
 from .credentials import (
     persona_secret,
     google_drive_username,
         'persona.secret': persona_secret,
         'google_drive.username': google_drive_username,
         'google_drive.password': google_drive_password,
-        'mail.username': email_host_username,
-        'mail.password': email_host_password,
         })
+    if email_host_username:
+        settings.update({'mail.username': email_host_username})
+    if email_host_password:
+        settings.update({'mail.password': email_host_password})
     config = Configurator(
         settings=settings,
         root_factory=Root)
     engine = engine_from_config(settings, 'sqlalchemy.')
     DBSession.configure(bind=engine)
     Base.metadata.bind = engine
+    celery.config_from_object(celery_config)
     return config.make_wsgi_app()
 
 

File randopony/celery_config.py

+# -*- coding: utf-8 -*-
+"""RandoPony-tetra celery configuration.
+"""
+
+# pragma: no cover
+BROKER_URL = 'sqla+sqlite:///celery.sqlite'
+
+CELERY_IMPORTS = (
+    'randopony.views.site.populaire',
+    )
+
+# CELERY_RESULT_BACKEND = 'database'
+# CELERY_RESULT_DBURI = 'sqlite:///celery.sqlite'
+# CELERY_RESULT_SERIALIZER = 'json'
+
+# CELERY_TIMEZONE = 'Canada/Pacific'
 CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
 
 requires = [
+    'celery',
     'colander',
     'deform',
     'gdata',
     'pyramid',
-    'pyramid_celery',
     'pyramid_debugtoolbar',
     'pyramid_deform',
     'pyramid_mailer',