项目作者: ozcanyarimdunya

项目描述 :
Django background tasks with 'threading' module.
高级语言: JavaScript
项目地址: git://github.com/ozcanyarimdunya/dj_threading.git
创建时间: 2019-06-02T01:16:13Z
项目社区:https://github.com/ozcanyarimdunya/dj_threading

开源协议:

下载


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

  1. make install

Make database migrations

  1. make migrations

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

  1. make start

Usage and installation on Docker

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

  1. make docker