django-background-tasks-example | An example app using django-background-tasks | Job Scheduling library
kandi X-RAY | django-background-tasks-example Summary
kandi X-RAY | django-background-tasks-example Summary
An example app using django-background-tasks
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- List tasks
- Post task
- Task handler
django-background-tasks-example Key Features
django-background-tasks-example Examples and Code Snippets
Community Discussions
Trending Discussions on django-background-tasks-example
QUESTION
This is a very naive question, but I feel I don't understand something fundamental about asynchronous/background tasks in django and python.
I try to replicate a simple example provided by django-background-tasks (https://github.com/collinmutembei/django-background-tasks-example) in order to make django perform a background task 60 seconds later than it was actually run. But I guess the same is valid for any other background task manager such as Celery or Huey
The example is pretty simple - as soon as the user accesses the url, a simple function that prints a message is executed without blocking the main django process, 60 sec later
...ANSWER
Answered 2017-May-25 at 05:57It is not necessary but good and helpful to run a separate process to run tasks in the background.
When you run a server, a process is created - run ps aux | grep runserver
- which is responsible for serving web requests. When you say that you want to run certain tasks in the background, it implicitly means that you want a separate process to execute those tasks. This is where asynchronous task tools like celery come in.
You can also spawn a separate process yourself - as you said - by doing:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-background-tasks-example
You can use django-background-tasks-example like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page