Bir Aracıyla Celery Kurulumu
Celery'yi Redis'e veya RabbitMQ'ya bağlayın.
Bir Aracıyla Celery Kurulumu, CoddyKit'te ücretsiz bir Django Academy dersidir. Bu, 4 dersinin 2. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Django Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Django Academy kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
What a Broker Is
Celery needs a broker: a middleman that holds queued tasks until a worker grabs them. Think of it as the inbox between your app and the workers.
Redis or RabbitMQ
The two common brokers are Redis (simple, fast, great default) and RabbitMQ (heavier, very robust). For most Django apps, Redis is plenty. 📨
Install the Packages
Start by installing Celery and the Redis client so Celery can talk to your broker over the network.
pip install celery redisCreate the Celery App
Add a celery.py next to settings.py. It creates the Celery instance and tells it where to find your Django config.
import os
from celery import Celery
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
app = Celery("myproject")Read Config from Settings
Point Celery at your Django settings so all its options live in one place, namespaced with a CELERY prefix.
app.config_from_object("django.conf:settings", namespace="CELERY")Auto-Discover Tasks
One line tells Celery to scan every installed app for a tasks module, so you never have to register tasks by hand.
app.autodiscover_tasks()Wire It into __init__
In your project __init__.py, import the Celery app so it loads whenever Django starts. This makes the shared task decorator work.
from .celery import app as celery_app
__all__ = ("celery_app",)Set the Broker URL
In settings.py, point CELERY_BROKER_URL at your running Redis instance so producers and workers share the same queue.
CELERY_BROKER_URL = "redis://localhost:6379/0"Add a Result Backend
If you want to read task results later, set a result backend. Redis can serve double duty as both broker and result store.
CELERY_RESULT_BACKEND = "redis://localhost:6379/0"Start a Worker
Run the worker from a terminal. It connects to the broker and waits for jobs. Keep your Django server running in a separate terminal. 🛠️
celery -A myproject worker -l infoTwo Processes, Always
Remember: the web server and the worker are separate processes. Both must run for background tasks to actually execute.
Quick Check
What job does the broker do in a Celery setup?
Recap: Celery Setup
Install Celery and a broker like Redis, create celery.py, set the broker URL, and run a worker in its own terminal. You are ready to queue. ✅
Sıkça Sorulan Sorular
“Bir Aracıyla Celery Kurulumu” dersi ücretsiz mi?
Evet — “Bir Aracıyla Celery Kurulumu” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Django Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Django Academy kursu toplamda 4 dersten oluşur.
“Bir Aracıyla Celery Kurulumu” dersinde ne öğreneceğim?
Celery'yi Redis'e veya RabbitMQ'ya bağlayın. Django Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Django Academy öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Django Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 2. dersidir.
“Bir Aracıyla Celery Kurulumu” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Django Academy dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Django Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Arka Plan Görevlerine Neden İhtiyacınız Var
- Bir Aracıyla Celery Kurulumu
- @shared_task Yazma ve Çağırma
- Celery Beat ile Zamanlanmış İşler