Extension Flask for integration with celery
Project description
Celery integrated with Flask
Project description
This library created for help our project using flask and celery as tasking management
Installation
To using this library, you need to install from pip
using this command
pip install celeryflask
Examples
To use this library you just add following code to your project:
from flask import Flask
from CeleryFlask import CeleryFlask
app = Flask(__name__)
celery_flask = CeleryFlask(app)
# or
celery_flask = CeleryFlask()
celery_flask.init_app(app)
@celery_flask.task
def hello():
print("Hello")
Before running celery, don't forget to add this configuration to you application config/settings:
CELERY_BROKER_URL = os.getenv("CELERY_BROKER_URL", None)
CLEERY_BACKEND = CELERY_BROKER_URL
CELERY_RESULT_BACKEND = os.getenv("CELERY_RESULT_BACKEND", None)
CELERY_DEFAULT_QUEUE = 'default'
CELERY_IMPORTS = (
# Add task here to use relative import task
)
# CELERY_TASK_RESULT_EXPIRES = 30
CELERY_TIMEZONE = 'UTC'
USE_TZ = True
CELERY_ENABLE_UTC = False
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_RESULT_EXPIRES = 120 # 2 mins
CELERYD_CONCURRENCY = 6
CELERYD_MAX_TASKS_PER_CHILD = 4
CELERYD_PREFETCH_MULTIPLIER = 1
CELERY_BROKER_URL = os.getenv("CELERY_BROKER_URL")
CELERY_RESULT_BACKEND = os.getenv("CELERY_RESULT_BACKEND")
CELERY_DEFAULT_QUEUE = 'your task queue'
CELERY_QUEUES = (
Queue('default', Exchange('default'), routing_key='default'),
Queue('your task queue', Exchange('your task queue'), routing_key='your task routing '),
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
CeleryFlask-0.0.2.tar.gz
(2.5 kB
view details)
Built Distribution
File details
Details for the file CeleryFlask-0.0.2.tar.gz
.
File metadata
- Download URL: CeleryFlask-0.0.2.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6e50a9215ddd050118ac056e24289fb0a00498a6485196f08e624d87bd705e6 |
|
MD5 | 8e34307048a8e06a3f5cb95db19d8bc6 |
|
BLAKE2b-256 | ef07a59d52bf961c26d24b4643893d39faa055f36644e71d254582af4696e778 |
File details
Details for the file CeleryFlask-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: CeleryFlask-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fbf21a5de459f76f16ce4d9cdf877b4b170cf81590164d11922f9dd329d25a8 |
|
MD5 | bb25e50d31c7a7ee974732036fb3ffdb |
|
BLAKE2b-256 | 6d38d3e7ae08b9895de769fc219ccfebcaf6794cde51e4c456846161c0d3cef4 |