Skip to main content

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 '),
    )

Metadata

Release files for CeleryFlask 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CeleryFlask 0.0.2
File Size Uploaded Provenance
CeleryFlask-0.0.2.tar.gz 2.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for CeleryFlask 0.0.2
File Interpreter ABI Platform
CeleryFlask-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.0 kB

Release files / CeleryFlask-0.0.2.tar.gz

Download URL CeleryFlask-0.0.2.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b6e50a9215ddd050118ac056e24289fb0a00498a6485196f08e624d87bd705e6
BLAKE2b-256 checksum
How to use checksums
ef07a59d52bf961c26d24b4643893d39faa055f36644e71d254582af4696e778
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / CeleryFlask-0.0.2-py3-none-any.whl

Download URL CeleryFlask-0.0.2-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fbf21a5de459f76f16ce4d9cdf877b4b170cf81590164d11922f9dd329d25a8
BLAKE2b-256 checksum
How to use checksums
6d38d3e7ae08b9895de769fc219ccfebcaf6794cde51e4c456846161c0d3cef4
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for CeleryFlask 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page