{"id":23071,"library":"django-user-tasks","title":"django-user-tasks","description":"Management of user-triggered asynchronous tasks in Django projects. Integrates with Celery and Django REST Framework to track task status and results. Current version: 4.0.0, released 2025. Monthly releases.","status":"active","version":"4.0.0","language":"python","source_language":"en","source_url":"https://github.com/openedx/django-user-tasks","tags":["django","celery","async-tasks","user-tracking"],"install":[{"cmd":"pip install django-user-tasks","lang":"bash","label":"Standard install"},{"cmd":"pip install django-user-tasks[cors]","lang":"bash","label":"With CORS support"}],"dependencies":[{"reason":"Required Django project","package":"Django","optional":false},{"reason":"Task queue backend","package":"Celery","optional":false},{"reason":"REST API for task management","package":"djangorestframework","optional":false}],"imports":[{"note":"Model for tracking task state","wrong":"","symbol":"UserTask","correct":"from django_user_tasks.models import UserTask"},{"note":"DRF viewset for task API","wrong":"","symbol":"UserTaskViewSet","correct":"from django_user_tasks.views import UserTaskViewSet"},{"note":"Function is in models, not tasks module","wrong":"django_user_tasks.tasks.create_user_task","symbol":"create_user_task","correct":"from django_user_tasks.models import create_user_task"},{"note":"DRF serializer for UserTask","wrong":"","symbol":"UserTaskSerializer","correct":"from django_user_tasks.serializers import UserTaskSerializer"}],"quickstart":{"code":"from django_user_tasks.models import create_user_task\n\n# Create a user task and trigger a Celery task\ndef my_view(request):\n    user = request.user\n    task_type = 'export'\n    task_kwargs = {'param1': 'value'}\n    user_task = create_user_task(user, task_type, task_kwargs)\n    return user_task.state  # e.g., 'PENDING'","lang":"python","description":"Create a user task that runs asynchronously. Requires Celery configured."},"warnings":[{"fix":"Update any code that reads or sets task headers to use the new 'id' key.","message":"In v4.0.0, Celery protocol v2 headers changed. The 'id' parameter name was updated. If you use custom Celery task headers, verify your code.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use Django's `storages` module instead of `django.core.files.storage.get_storage`.","message":"The function `get_storage` has been deprecated in Django 5.2. In v3.4.1, a fix was applied; but if you call `get_storage` directly, update to Django's new storage API.","severity":"deprecated","affected_versions":"<3.4.1"},{"fix":"Import from `django_user_tasks.models`.","message":"`create_user_task` is not in the `tasks` module. Many users import it incorrectly as `from django_user_tasks.tasks import create_user_task`.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install django-user-tasks` and add 'django_user_tasks' to INSTALLED_APPS in settings.py.","cause":"Package not installed or not added to INSTALLED_APPS.","error":"ModuleNotFoundError: No module named 'django_user_tasks'"},{"fix":"Use `from django_user_tasks.models import create_user_task`.","cause":"Incorrect import path; the function is in models, not top-level.","error":"AttributeError: module 'django_user_tasks' has no attribute 'create_user_task'"},{"fix":"Set up Django settings before using the library, e.g., `os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')`.","cause":"Trying to use django-user-tasks outside of a Django project (e.g., standalone script).","error":"django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}