Integrating django-eztaskmanager into an existing project

This guide is designed for developers who wish to incorporate django-eztaskmanager into their existing Django project.

  1. Install the application using pip:

    Via PyPI:

    pip install django-eztaskmanager
    

    Or directly from GitHub:

    pip install git+https://github.com/openpolis/django-eztaskmanager.git
    
  2. Include “eztaskmanager” in your INSTALLED_APPS setting as follows:

    INSTALLED_APPS = [
        "django.contrib.admin",
        # ...,
        "taskmanager",
    ]
    
  3. Install and configure ‘django-rq’ and ‘django-scheduler’ or ‘celery’ and ‘celery-beats’ if they are not already included in your project.

  4. Run python manage.py migrate to generate the eztaskmanager tables.

  5. Execute the collectcommands management task to create taskmanager commands [1]:

    python manage.py collectcommands --excludecore
    
  6. Include the eztaskmanager URL configuration in your project’s urls.py file:

    from django.contrib import admin
    from django.urls import path, include
    
    urlpatterns = [
        path('admin/', admin.site.urls),
        path('django-rq/', include('django_rq.urls')),
        path('eztaskmanager/', include('eztaskmanager.urls'))
    ]
    
  7. Configure parameters in your settings file as delineated below (optional). Uncommented settings represent default values:

    # eztaskmanager
    # EZTASKMANAGER_QUEUE_SERVICE_TYPE = 'RQ'
    # EZTASKMANAGER_N_LINES_IN_REPORT_LOG = 10
    # EZTASKMANAGER_N_REPORTS_INLINE = 10
    # EZTASKMANAGER_SHOW_LOGVIEWER_LINK = True
    # EZTASKMANAGER_USE_FILTER_COLLAPSE = True
    # EZTASKMANAGER_NOTIFICATION_HANDLERS = {}
    # EZTASKMANAGER_BASE_URL = None
    EZTASKMANAGER_NOTIFICATION_HANDLERS = {
        "email-errors": {
            "class": "eztaskmanager.services.notifications.EmailNotificationHandler",
            "level": "failure",
            "from_email": "admin@example.com",
            "recipients": ["admin@example.com", ],
        },
    }
    
    EZTASKMANAGER_N_LINES_IN_REPORT_LOG = 5
    # EZTASKMANAGER_SHOW_LOGVIEWER_LINK = False
    
  8. Follow the How to enable notifications guide to set up notifications (optional).

Footnotes