Base setup

This commit is contained in:
2025-09-23 13:30:03 +08:00
parent 1057ed8690
commit e51154bb29
34 changed files with 2574 additions and 1 deletions

17
crawler_project/celery.py Normal file
View File

@@ -0,0 +1,17 @@
import os
from celery import Celery
# 设置Django设置模块
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'crawler_project.settings')
app = Celery('crawler_project')
# 使用Django设置文件配置Celery
app.config_from_object('django.conf:settings', namespace='CELERY')
# 自动发现任务
app.autodiscover_tasks()
@app.task(bind=True)
def debug_task(self):
print(f'Request: {self.request!r}')