{"id":20652331,"url":"https://github.com/openpolis/django-uwsgi-taskmanager","last_synced_at":"2025-04-18T16:19:02.423Z","repository":{"id":53716177,"uuid":"196581381","full_name":"openpolis/django-uwsgi-taskmanager","owner":"openpolis","description":"Django application to monitor and manage long and/or recurring tasks through uWSGI.","archived":false,"fork":false,"pushed_at":"2023-01-16T00:18:25.000Z","size":6126,"stargazers_count":23,"open_issues_count":5,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-02T00:58:34.743Z","etag":null,"topics":["django","python","uwsgi"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openpolis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-12T13:09:38.000Z","updated_at":"2024-01-13T19:15:38.000Z","dependencies_parsed_at":"2023-02-10T00:15:57.250Z","dependency_job_id":null,"html_url":"https://github.com/openpolis/django-uwsgi-taskmanager","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openpolis%2Fdjango-uwsgi-taskmanager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openpolis%2Fdjango-uwsgi-taskmanager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openpolis%2Fdjango-uwsgi-taskmanager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openpolis%2Fdjango-uwsgi-taskmanager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openpolis","download_url":"https://codeload.github.com/openpolis/django-uwsgi-taskmanager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249517782,"owners_count":21284836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","python","uwsgi"],"created_at":"2024-11-16T17:33:55.215Z","updated_at":"2025-04-18T16:19:02.403Z","avatar_url":"https://github.com/openpolis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django uWSGI Taskmanager\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)\n\nDjango application to manage async tasks via admin interface, using uWSGI spooler.\n\nSee documentation at http://django-uwsgi-taskmanager.rtfd.io/\n\n## Features\n\n- Start and stop your tasks via admin\n- Schedule tasks\n- Plan tasks as cron items\n- Check or download the generated reports/logs\n- Simply write a standard Django `Command` class (your app doesn't need to interact with Django uWSGI Taskmanager)\n- Get notifications via Slack or email when a task fails\n\n## Installation\n\n0.  Install the app with `pip`:\n\n    -  via PyPI:\n\n       `pip install django-uwsgi-taskmanager`\n\n    -  or via GitHub:\n\n       `pip install git+https://github.com/openpolis/django-uwsgi-taskmanager.git`\n\n1.  Add \"taskmanager\" to your `INSTALLED_APPS` setting like this:\n\n    ```python\n    INSTALLED_APPS = [\n        \"django.contrib.admin\",\n        # ...\n        \"taskmanager\",\n    ]\n    ```\n\n2. Run `python manage.py migrate` to create the taskmanager tables.\n\n3. Run `python manage.py collectcommands` to create taskmanager commands.\n\n4. Include the taskmanager URLConf in your project `urls.py` like this _(optional)_:\n\n    ```python\n    from django.contrib import admin\n    from django.urls import include, path\n    \n    urlpatterns = [\n        path(\"admin/\", admin.site.urls),\n        path(\"taskmanager/\", include(\"taskmanager.urls\")),\n    ]\n    ```\n\n5. Set parameters in your settings file as below _(optional)_:\n\n    ```pythonstub\n    UWSGI_TASKMANAGER_N_LINES_IN_REPORT_INLINE = 10\n    UWSGI_TASKMANAGER_N_REPORTS_INLINE = 3\n    UWSGI_TASKMANAGER_SHOW_LOGVIEWER_LINK = True\n    UWSGI_TASKMANAGER_USE_FILTER_COLLAPSE = True\n    UWSGI_TASKMANAGER_SAVE_LOGFILE = False\n    ```\n\n## Usage\n\nYou just need to install `django-uwsgi-taskmanager` in your Django Project and run `collectcommands` as described.\nDjango uWSGI Taskmanager will collect all the commands and make them available for asynchronous scheduling in the admin.\n\nIf you need a new asynchronous task, just write a standard custom Django command, and synchronize the app. Then go to the admin page and schedule it.\n\nYou can disable some commands from the admin, and let users (with limited permissions) schedule only the available ones.\n\nuWSGI ini file (vassal) has to include the [spooler](https://uwsgi-docs.readthedocs.io/en/latest/Spooler.html) and [pythonpath](https://uwsgi-docs.readthedocs.io/en/latest/PythonDecorators.html) option.\n\n\u003e **NOTE**: remember to manually create the `spooler` directory with right permissions before start uWSGI\n\n## Enabling notifications\n\nTo enable Slack notifications support for failing tasks, you have to first install the\nrequired packages, which are not included by default. To do that, just:\n\n    pip install django-uwsgi-taskmanager[notifications]\n    \nThis will install the `django-uwsgi-taskmanager` package from PyPI, including the optional dependencies\nrequired to make Slack notifications work. \n\nEmail notifications are instead handled using Django [`django.core.mail`](https://docs.djangoproject.com/en/2.2/topics/email/) \nmodule, so no further dependencies are needed and they should work out of the box, given you have at\nleast one [email backend](https://docs.djangoproject.com/en/2.2/topics/email/#email-backends) properly\nconfigured.\n\nThen, you have to configure the following settings:\n\n- `UWSGI_TASKMANAGER_NOTIFICATIONS_SLACK_TOKEN`, which must be set with you own Slack token as string.\n- `UWSGI_TASKMANAGER_NOTIFICATIONS_SLACK_CHANNELS`, a list of strings representing the names or ids of the channels which will receive the notifications.\n- `UWSGI_TASKMANAGER_NOTIFICATIONS_EMAIL_FROM`, the \"from address\" you want your outgoing notification emails to use.\n- `UWSGI_TASKMANAGER_NOTIFICATIONS_EMAIL_RECIPIENTS`, a list of strings representing the recipients of the notifications.\n\n### Demo\n\nThis a basic Django demo project with a `uwsgi.ini` file and four directories (`media`, `spooler`, `static`, `venv`).\n\n```\ndemo/\n├── demo/\n│   ├── __init__.py\n│   ├── settings.py\n│   ├── urls.py\n│   └── wsgi.py\n├── manage.py\n├── media/\n├── spooler/\n├── static/\n├── uwsgi.ini\n└── venv/\n```\n\nThis is the content of `uwsgi.ini` file required to execute the project with Django:\n\n```ini\n[uwsgi]\nchdir = %d\nenv = DJANGO_SETTINGS_MODULE=demo.settings\nhttp-socket = :8000\nmaster = true\nmodule = demo.wsgi\nplugin = python3\npythonpath = %d\nspooler = %dspooler\nstatic-map = /static/=%dstatic\nvirtualenv = %dvenv\n```\n\n#### Try the demo project\n\nEnter the demo directory, then create and activate the demo virtual environments:\n\n```bash\n$ cd demo\n$ mkdir -p venv\n$ python3 -m venv ./venv\n$ source ./venv/bin/activate\n```\n\nInstall Django uWSGI taskmanager:\n\n```bash\n(venv) $ pip install django-uwsgi-taskmanager\n```\n\nInstall uWSGI (if you use uWSGI of your OS you can skip this step):\n\n```bash\n(venv) $ pip install uwsgi\n```\n\nCollect all static files:\n\n```bash\n(venv) $ python manage.py collectstatic\n```\n\nCreate all the tables:\n\n```bash\n(venv) $ python manage.py migrate\n```\n\nCollect all commands:\n\n```bash\n(venv) $ python manage.py collectcommands\n```\n\nCreate a super user to login to the admin interface:\n\n```bash\n(venv) $ python manage.py createsuperuser\n```\n\nStart the project with uWSGI:\n\n```bash\n(venv) $ uwsgi --ini uwsgi.ini\n```\n\nVisit http://127.0.0.1:8000/admin/\n\n## Copyright\n\n**Django uWSGI taskmanager** is an application to manage async tasks via admin interface, using uWSGI spooler.\n\nCopyright (C) 2019-2020 Gabriele Giaccari, Gabriele Lucci, Guglielmo Celata, Paolo Melchiorre\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as\npublished by the Free Software Foundation, either version 3 of the\nLicense, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenpolis%2Fdjango-uwsgi-taskmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenpolis%2Fdjango-uwsgi-taskmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenpolis%2Fdjango-uwsgi-taskmanager/lists"}