Skip to content

app-generator/sample-django-tasks-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Tasks Manager - How to use it

This repository provides a step-by-step integration of Django Tasks Manager, an open-source Python Library built on top of Celery. In the end, the superusers are able to manage tasks (create, revoke) and visualize the output and runtime logs - The product is actively supported by AppSeed.

Features

  • ✅ Create/Revoke Celery Tasks
  • ✅ View LOGS & Output
  • ✅ Minimal Configuration
  • ✅ Installation via PyPi
  • ✅ Available TASKS (provided as starting samples)
    • users_in_db() - List all registered users
    • execute_script() - let users execute the scripts defined in CELERY_SCRIPTS_DIR (configuration parameter)

Django Tasks Manager - Sample


👉 Added minimal files - v0.0.1 tag

In this phase only the basic files are provided:

  • README.md
  • CHANGELOG.md
  • .gitignore

Besides the files, the Virtual environment is created:

$ python3 -m venv env        # create virtual environment 
$ source env/bin/activate    # actvate the VENV 
$ pip install --upgrade pip  # update PIP

👉 Generate Django Core - v0.0.2 tag

In this phase, the usual commands are used:

$ pip install Django                # Install Django  
$ django-admin startproject core .  # create 'core' project 
$ python manage.py migrate          # migrate DB
$ python manage.py runserver        # Access the basic app in the browser

👉 Install Django TM Package - v0.0.3 tag

The new is installed and the related directories are created:

$ pip install django-tasks-manager  # install the package 
$ mkdir celery_logs                 # here the logs are saved
$ mkdir celery_scripts              # scripts to be executed 

The sample scripts are provided in the Celery Scripts folder.


👉 Update Project Configuration - v0.0.4 tag

Update configuration and routing. Here are the impacted files:

  • core/settings.py
  • core/urls.py

👉 Final set up & Usage - v1.0.0 tag

In this phase the project becomes usable. The database is migrated and a superuser is created to access and manage the tasks.

$ python manage.py makemigrations      # generate the new SQL
$ python manage.py migrate             # migrate (update) DB
$
$ python manage.py createsuperuser     # create the app user
$
$ # Start the application 
$ python manage.py runserver           

Note: The celery task manager should be started using a different terminal

$ celery --app=django_tm.celery.app worker --loglevel=info

Once the superuser is authenticated, the tasks manager should be usable:

http://127.0.0.1:8000/tasks


Django Tasks Manager - Tasks View Log.


Django Tasks Manager - View ALL Tasks.


Django Tasks Manager - View tasks in admin section.



Django Tasks Manager - Free sample provided by AppSeed