Skip to main content

Celery Eye

Celery Eye is a Django app that logs and displays Celery task execution details in the Django Admin panel. It enables developers and operators to monitor task history, status, and performance directly from the web UI.


🚀 Features

  • Logs all executed Celery tasks in real-time
  • View task name, status, start time, end time, and more
  • Admin interface to search, filter, and debug tasks
  • Lightweight and easy to integrate
  • Works with Redis and Celery 5+

📦 Installation

pip install celery-eye

🛠️ Prerequisites

Before installing celery-eye, ensure your Django project is already configured with Celery and Redis.


🔧 Project Setup

1. Configure celery.py

Create a celery.py file in your main Django project folder (same level as settings.py):

# myproject/celery.py
import os
from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')

app = Celery('myproject')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()

2. Update __init__.py to initialize Celery

# myproject/__init__.py
from .celery import app as celery_app

__all__ = ['celery_app']

⚙️ settings.py Configuration

Add the following Celery and Redis configuration in your settings.py:

import os

# Celery Configuration
CELERY_BROKER_URL = os.getenv("CELERY_BROKER_URL", "redis://localhost:6379/0")
CELERY_ACCEPT_CONTENT = ["json"]
CELERY_TASK_SERIALIZER = "json"
CELERY_TIMEZONE = os.getenv("DEFAULT_TIMEZONE", "UTC")  # or your desired timezone
CELERY_LOG_DIR = BASE_DIR / "logs"  # or any path like "/var/logs/celery_eye/ or your path mount in your docker volumes"

Make sure you have Redis running locally or remotely.


🧩 Django Integration

1. Add celery_eye to INSTALLED_APPS

INSTALLED_APPS = [
    ...
    'celery_eye',
]

2. Configure MYPROJECT/urls.py

urlpatterns = [
    path("celery-eye/", include("celery_eye.urls")),
]

3. Run migrations

python manage.py migrate

4. Create a superuser (if you haven't)

python manage.py createsuperuser

5. Start your services

Make sure your services are running:

# Run Redis
redis-server

# Run Celery Worker (in your Django root directory)
celery -A myproject worker --loglevel=info

# Run Django server
python manage.py runserver

You should now be able to:

  • See Celery task execution logs in the Django Admin
  • Filter/search by status, task name, and timestamps

🧪 Example Task

# any_app/tasks.py
from celery import shared_task

@shared_task
def test_task(x, y):
    return x + y

Trigger in a Django shell:

python manage.py shell
from any_app.tasks import test_task
test_task.delay(5, 7)

🐳 Optional: Redis with Docker

You can spin up Redis with Docker:

docker run -d -p 6379:6379 redis

🤝 Contributing

Pull requests, issues, and feature suggestions are welcome!


📄 License

MIT License. See LICENSE for more details.

Metadata

Release files for celery-eye 0.2.1

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

Source distribution (sdist)

Source distribution for celery-eye 0.2.1
File Size Uploaded
celery_eye-0.2.1.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for celery-eye 0.2.1
File Interpreter ABI Platform
celery_eye-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.2 kB

Release files / celery_eye-0.2.1.tar.gz

Download URL celery_eye-0.2.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8487696df66e0bba283db5a7ef2a5c5dfa60aabd4c2dcf1be50a2ace178d1a35
BLAKE2b-256 checksum
How to use checksums
f62f8a1ab0f5a7f69435eee55abadaa75d1476d1ca4709eeb0c88c026fe5aa83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release files / celery_eye-0.2.1-py3-none-any.whl

Download URL celery_eye-0.2.1-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98a6e354effccf945fcb2089922b5244cc8b4e53eeed10b51b3204cfff965cb5
BLAKE2b-256 checksum
How to use checksums
cce88381738f99666c7c4f2f71516bb089e933e389128bb8b42e782ba0634588
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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