Created
October 9, 2018 19:45
-
-
Save craigderington/a4b2c1d011ffeb4ed3ac648052f6176b to your computer and use it in GitHub Desktop.
Config module for Celery project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from kombu import Queue, Exchange | |
| BASEDIR = os.path.abspath(os.path.dirname(__file__)) | |
| class Config(object): | |
| DEBUG = False | |
| SECRET_KEY = os.urandom(32) | |
| SQLALCHEMY_TRACK_MODIFICATIONS = False | |
| SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', SQLITE_DB) | |
| CELERY_TIMEZONE = 'US/Eastern' | |
| CELERY_BROKER_URL = 'amqp://localhost/' | |
| CELERY_RESULT_BACKEND = 'rpc://' | |
| # define the tasks queues | |
| CELERY_QUEUES = ( | |
| Queue('default', Exchange('default'), routing_key='default') | |
| ) | |
| # define the task routes | |
| CELERY_ROUTES = { | |
| 'default': {'queue': 'default', 'routing_key': 'default'} | |
| } | |
| class DevelopmentConfig(Config): | |
| DEBUG = True | |
| class ProductionConfig(Config): | |
| DEBUG = False | |
| config = { | |
| 'development': DevelopmentConfig, | |
| 'production': ProductionConfig | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment