ozcanyarimdunya / dj_threading

Django background tasks with 'threading' module.

Home Page:https://ozcanyarimdunya.github.io/dj_threading/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django with multithreading

Django background tasks with threading module.

NOTE: No need celery anymore for single-time-run background tasks

Documentation: https://ozcanyarimdunya.github.io/dj_threading/

How it works

  1. User send a request to start a long running task
  2. Django receives the thread and spawns a thread to do something else.
  3. Thread starts working at background
  4. Django finish his actions and send response to user
  5. (Later) Thread finished

We created a django model when user starts a task and this model's id sent to long running task as argument.

We can get/change/save model in this task. During this time we can access this model on any django view.

So with this we can set custom status on model in task and access them in anywhere at anytime.

Usage and Installation on local

Install the requirements

make install 

Make database migrations

make migrations

Run the server and open a browser then navigate to http://localhost:8000

make start

Usage and installation on Docker

Run below command and open a browser then navigate to http://localhost:8000

make docker

About

Django background tasks with 'threading' module.

https://ozcanyarimdunya.github.io/dj_threading/


Languages

Language:JavaScript 56.7%Language:Python 27.1%Language:HTML 10.2%Language:CSS 2.4%Language:Makefile 1.5%Language:Dockerfile 1.1%Language:Shell 1.0%