Django application to manage async tasks via admin interface, using uWSGI spooler.
Project description
Django uWSGI Taskmanager
Django application to manage async tasks via admin interface, using uWSGI spooler.
Features
- Start and stop your tasks via admin
- Schedule tasks
- Plan tasks as cron items
- Check or download the generated reports/logs
- Simply write a standard Django Command class (your app doesn't need to interact with Django uWSGI Taskmanager)
Installation
-
Pip install the app:
-
via pypi:
pip install django-uwsgi-taskmanager
-
or via github:
pip install git+https://github.com/openpolis/django-uwsgi-taskmanager.git
-
-
Add "taskmanager" to your
INSTALLED_APPS
setting like this:INSTALLED_APPS = [ "django.contrib.admin", # ... "taskmanager", ]
-
Run
python manage.py migrate
to create the taskmanager tables. -
Run
python manage.py collectcommands
to create taskmanager commands. -
Include the taskmanager URLconf in your project
urls.py
like this (optional):from django.contrib import admin from django.urls import include, path urlpatterns = [ path("admin/", admin.site.urls), path("taskmanager/", include("taskmanager.urls")), ]
-
Set parameters in your settings file as below (optional):
TASK_MANAGER_N_LINES_IN_REPORT_INLINE = 10 TASK_MANAGER_N_REPORTS_INLINE = 3 TASK_MANAGER_SHOW_LOGVIEWER_LINK = True TASK_MANAGER_USE_FILTER_COLLAPSE = True TASK_MANAGER_SAVE_LOGFILE = False
Usage
You just need to install django-uwsgi-taskmanager
in your Django Project and run collectcommands
as described.
Django uWSGI Taskmanager will collect all the commands and make them available for asynchronous scheduling in the admin.
If 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.
You can disable some commands from the admin, and let users (with limited permissions) schedule only the available ones.
uWSGI ini file (vassal) has to include the spooler and pythonpath option.
NOTE: remember to manually create the
spooler
directory with right permissions before start uWSGI
Demo
This a basic Django demo project with a uwsgi.ini
file and four directories (media
, spooler
, static
, venv
).
demo/
├── demo/
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── manage.py
├── media/
├── spooler/
├── static/
├── uwsgi.ini
└── venv/
This is the content of uwsgi.ini
file required to execute the project with Django:
[uwsgi]
chdir = %d
env = DJANGO_SETTINGS_MODULE=demo.settings
http-socket = :8000
master = true
module = demo.wsgi
plugin = python3
pythonpath = %d
spooler = %dspooler
static-map = /static/=%dstatic
virtualenv = %dvenv
Try the demo project
Enter the demo directory, then create and activate the demo virtual environments:
$ cd demo
$ mkdir -p venv
$ python3 -m venv ./venv
$ source ./venv/bin/activate
Install Django uWSGI taskmanager:
(venv) $ pip install django-uwsgi-taskmanager
Install uWSGI (if you use uWSGI of your OS you can skip this step):
(venv) $ pip install uwsgi
Collect all static files:
(venv) $ python manage.py collectstatic
Create all the tables:
(venv) $ python manage.py migrate
Collect all commands:
(venv) $ python manage.py collectcommands
Create a super user to login the admin:
(venv) $ python manage.py createsuperuser
Start the project with uWSGI:
(venv) $ uwsgi --ini uwsgi.ini
Visit http://127.0.0.1:8000/admin/
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
1.0.1 - 2019-07-13
Changed
- Rename
collect_commands
tocollectcommands
- Add missings setps in
README.md
Fixed
- Fix version 1.0.0 release date in
CHANGELOG.md
- Add missing
__init__.py
in migrations directory - Add missing
STATIC_ROOT
in demo settings - Add missing media directory and settings
- Fix convert to local datetime function
- Update and complete
setup.py
1.0.0 - 2019-07-12
Added
- First release
Authors
- Gabriele Giaccari (@gabbork)
- Gabriele Lucci (@gabrielelucci)
- Guglielmo Celata (@guglielmo)
- Paolo Melchiorre (@pauloxnet)
License
Django uWSGI taskmanager is an application to manage async tasks via admin interface, using uWSGI spooler.
Copyright (C) 2019 Gabriele Giaccari, Gabriele Lucci, Guglielmo Celata, Paolo Melchiorre
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for django-uwsgi-taskmanager-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43c37fba8ae61e5989aa2e665ccdd854d8c84c93556651b4afd50c047de79dc1 |
|
MD5 | f1af9cc266c690c0b966d210d87bb31a |
|
BLAKE2b-256 | 358beb461d38a5c5575f3c1af0557a87c3aff534f71cc22f703268c16dd5d039 |
Hashes for django_uwsgi_taskmanager-1.0.1-py3.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 599bf484e6bba8e0e4011a2697502cb01b5bedf5b922e61bd067cda39671aae5 |
|
MD5 | b5fa0bacb49a2134b219c75ac0756e5b |
|
BLAKE2b-256 | 8d6eeaf545a009d19a14d73d45b26d151275a715069493d4664a4d368e1e3f36 |
Hashes for django_uwsgi_taskmanager-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8989165f68f25beaa346a853be61149d482cd755510d70879ed603c2f4d0a98 |
|
MD5 | 093bd790cdd99cb78eb6e157e65d42b0 |
|
BLAKE2b-256 | 31466be7d0817275ca372b9f6deb7c618dc6385fa942c7c5797c8f7801176d10 |