{"id":10830,"date":"2020-06-24T11:17:58","date_gmt":"2020-06-24T05:47:58","guid":{"rendered":"https:\/\/www.botreetechnologies.com\/blog\/?p=10830"},"modified":"2021-09-13T17:42:30","modified_gmt":"2021-09-13T12:12:30","slug":"implementing-celery-using-django-for-background-task-processing","status":"publish","type":"post","link":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/","title":{"rendered":"Implementing Celery using Django for Background Task Processing"},"content":{"rendered":"\n<p>In the initial stages, Django web development starts really simple. The application has to respond only to HTTP requests. <a href=\"https:\/\/www.botreetechnologies.com\/django-development\" target=\"_blank\" rel=\"noreferrer noopener\">Django application development<\/a> is one of the best ways to do that as well.<\/p>\n\n\n\n<p>But quickly, the application takes more responsibility for processing requests. Now, a distinction has to be made between the tasks that need to happen immediately and the tasks that can be executed eventually.<\/p>\n\n\n\n<p>Operations that must happen instantly are called request-time operations. Operations that can happen eventually are known as background tasks.<\/p>\n\n\n\n<p>While request-time operations are completed in a single response\/request cycle, background tasks are more time-consuming.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Django Development: The Common Background Tasks<\/h2>\n\n\n\n<p>There are several tasks in Django for web development which are not instantaneous. These tasks take time, and certain tasks run in the background while creating Django applications. Some of them include,<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Sending emails for confirmation or execution.<\/li><li>Third party Api Integration where the response from the third party api will take time.<\/li><li>scrapping of some sites which will take time so we will perform scrapping in background task.<\/li><li>Suppose we want to delete records in database periodically like considering the in a chat app we want to delete the messages which are a month old.<\/li><\/ol>\n\n\n\n<p>These tasks are not essential in Django web applicationdevelopment and can be executed gradually as time passes by. Since they are slow, they can\u2019t be executed in the response\/request cycle in Django web framework.<\/p>\n\n\n\n<p>On top of that, there might be a need to retire these tasks at least once. Background tasks have to be executed on schedule.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Read more: <a href=\"https:\/\/www.botreetechnologies.com\/blog\/django-web-framework-startups\/\" target=\"_blank\" rel=\"noreferrer noopener\">7 Reasons Django Web Framework is Perfect for Startups<\/a><\/strong><\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Django Development: Implementing Celery and Redis<\/h2>\n\n\n\n<p>Celery is widely used for background task processing in Django web development. With a simple and clear API, it integrates seamlessly with the Django ecosystem.<\/p>\n\n\n\n<p>Celery is an asynchronous task queue\/job queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well.<\/p>\n\n\n\n<p>It is a <a href=\"https:\/\/www.botreetechnologies.com\/blog\/how-to-reuse-your-code-with-python-package\/\" target=\"_blank\" rel=\"noreferrer noopener\">python development package with features<\/a> that enable us to implement:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Time consuming operations in an asynchronous manner.<\/li><li>Periodic operations in a cron-esque manner.<\/li><li>To call external API\u2019s.<\/li><\/ul>\n\n\n\n<p><strong>Practical example of Celery include:-<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>To perform certain tasks to be run&nbsp; in future, like calling an external API every hour or need to send emails at a specific day.<\/li><li>Whenever a time-consuming process needs to be performed, celery can be used to perform that task in the background, as resources become available, so that your application can continue to respond to client requests. This skips the wait of the end user for the process to complete.<\/li><\/ol>\n\n\n\n<p>Suppose we want to send emails from our django web application using celery.<\/p>\n\n\n\n<p>At that time <strong>Celery<\/strong> communicates via messages, usually using a broker, to mediate between clients and workers.<\/p>\n\n\n\n<p>Several Brokers that can be used are Redis, RabitMQ, SQS etc.. These are used to send the task (perform email send) to the Workers and Workers perform those tasks.<\/p>\n\n\n\n<p>Hence, the server gives a quick response to the user and an email is sent via background process using celery.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Implementation of Celery using Redis as broker and Django Framework:<\/h2>\n\n\n\n<p>We have a project called VoiceChat, and we want to send an approval email(Non Periodic Task ) to the user who has requested to sign up. Here, we have sent mail through celery and Delete Messages on Aws and database (Periodic Task ) using celery.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"490\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/celery-architecture.jpg\" alt=\"celery architecture\" class=\"wp-image-13007\" srcset=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/celery-architecture.jpg 768w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/celery-architecture-300x191.jpg 300w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/celery-architecture-660x420.jpg 660w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p>In this, we have a Virtual environment named chat_venv. Inside that, we will install celery and redis as a broker.<\/p>\n\n\n\n<p><code>pip install celery==4.3.0<\/code><\/p>\n\n\n\n<p><code>pip install redis==3.2.0<\/code><\/p>\n\n\n\n<p>Our project structure is like this<\/p>\n\n\n\n<p>VoiceChat\/<br>| &#8211; &#8211; manage.py<br>| &#8211; &#8211; requirements.txt<\/p>\n\n\n\n<p>|&#8211;templates<br>|&#8211;voicechatproject\/<br>|&nbsp; |&#8211; __init__.py<br>|&nbsp; |&#8211; celery.py<br>|&nbsp; |&#8211; settings.py<br>|&nbsp; |&#8211; wsgi.py<br>|&nbsp; |&#8211; urls.py<br>|&#8211;request_access\/<br>|&nbsp; |&#8211; migrations\/<br>|&nbsp; |&#8211; __init__.py<br>|&nbsp; |&#8211; tasks.py<br>|&nbsp; |&#8211; views.py<br>|&nbsp; |&#8211; signals.py<br>|&nbsp; |&#8211; tokens.py<br>|&nbsp; |&#8211; urls.py<br>|&nbsp; |&#8211; models.py<br>|&#8211;message\/<br>|&nbsp; |&#8211; migrations\/<br>|&nbsp; |&#8211; __init__.py<br>|&nbsp; |&#8211; tasks.py<br>|&nbsp; |&#8211; views.py<br>|&nbsp; |&#8211; signals.py<br>|&nbsp; |&#8211; tokens.py<br>|&nbsp; |&#8211; urls.py<br>|&nbsp; |&#8211; models.py<\/p>\n\n\n\n<p>In <code>voicechatproject\/settings.py<\/code>, we have added the following code.<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/MeetParikh01\/b08e314881c0a962074747642d7dba09.js\"><\/script><\/p>\n\n\n\n<p>In <code>voicechatproject\/celery.py<\/code>, we have written the following code.<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/MeetParikh01\/c426ff7c691bf572928b872de732915b.js\"><\/script><\/p>\n\n\n\n<p>In <code>voicechatproject\/__init__.py<\/code> we have the following code.<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/MeetParikh01\/e3a8c8bf7cd3794582e069c69b3f2c4f.js\"><\/script><\/p>\n\n\n\n<p>Thus, here we have done initial setup for celery and now we need to write the tasks which are to be performed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Non Periodic Task<\/h3>\n\n\n\n<p>Here we will send an email through celery<\/p>\n\n\n\n<p>In <code>request_access\/tasks.py<\/code> we have written the following code.<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/MeetParikh01\/f20aa47ff167e8849e8fec834423b455.js\"><\/script><\/p>\n\n\n\n<p>Now this task are called in <code>request_access\/signals.py<\/code><\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/MeetParikh01\/64d7ad377806bded29002558e615310a.js\"><\/script><\/p>\n\n\n\n<p>Thus, here the delay method is used to place the task in the queue and returns a promise that can be used to monitor the status and get the result when it&#8217;s ready.<\/p>\n\n\n\n<p>Here the delay method calls the specific task described in task.py in order to send the email.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Periodic Task<\/h3>\n\n\n\n<p>Here we will delete messages on aws and in the database.<\/p>\n\n\n\n<p>Now to perform periodic tasks, we have written message\/tasks.py where we will delete the message on aws and in database with the following code.<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/MeetParikh01\/96593b6098d4834fdbcef2edc2a7bd4c.js\"><\/script><\/p>\n\n\n\n<p>Now in order to delete messages from aws we have used boto3 in periodic function where the periodic task is called by celery on every minute which identifies the message. Within periodic tasks, we have called other non periodic tasks to delete messages from database and in aws.<\/p>\n\n\n\n<p>In that, a word called&nbsp; Crontab is used where we have defined the periodic task to run every minute but you can also call periodic task on different crontab for that you can refer <a href=\"https:\/\/docs.celeryproject.org\/en\/latest\/userguide\/periodic-tasks.html\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">here.<\/a><\/p>\n\n\n\n<p>Run the Celery through terminal<\/p>\n\n\n\n<p>In order to run celery we have used Redis as a broker and we have installed it using the following command.<\/p>\n\n\n\n<p><code>$ sudo apt update<\/code><br><code>$ sudo apt install redis-server<\/code><\/p>\n\n\n\n<p>Now in order to run the celery task we need to first fire up the redis server using the below command in shell.<\/p>\n\n\n\n<p><code>$ redis-server<\/code><\/p>\n\n\n\n<p>You can test that Redis is working properly by typing this into your terminal:<\/p>\n\n\n\n<p><code>$ redis-cli ping<\/code><\/p>\n\n\n\n<p>If using the above command we should&nbsp; get <strong>PONG<\/strong> as result.<\/p>\n\n\n\n<p>Now we need to start the worker and scheduler in the terminal.<\/p>\n\n\n\n<p><code>$ celery -A voicechatproject worker -l info<\/code><br><code>$ celery -A voicechatproject beat -l info<\/code><\/p>\n\n\n\n<p>Deploy celery part in django<\/p>\n\n\n\n<p>You can deploy your django web development project as per the following <a href=\"http:\/\/www.ysagade.nl\/2012\/05\/11\/nginx-gunicorn-https\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">link<\/a>,&nbsp; and you would like to run the worker process through celery as follows.<\/p>\n\n\n\n<p>We need an SSH for it to run, so enter the following command in the shell<\/p>\n\n\n\n<p><code>$ sudo apt-get install supervisor<\/code><\/p>\n\n\n\n<p>After this we need to create the configuration files to the <code>\u201c\/etc\/supervisor\/conf.d\/\u201d<\/code>&nbsp; directory on the remote server inorder to inform the supervisor<\/p>\n\n\n\n<p>In our case, we need to create two configuration files &#8211; one for the Celery worker and one for the <strong>Celery scheduler.<\/strong><\/p>\n\n\n\n<p>So, we have created a local directory in our project root \u201c<strong>VoiceChat<\/strong>\u201d by name \u201c<strong>Supervisor<\/strong>\u201d.<\/p>\n\n\n\n<p>In that folder we have created 2 configuration files namely&nbsp; \u2018voicechatproject_worker.conf\u2019 for celery worker and <code>\u2018voicechatproject_scheduler.conf\u2019<\/code> for celery beat scheduler.<\/p>\n\n\n\n<p>Now in <code>voicechatproject_worker.conf<\/code> we have written the following code.<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/MeetParikh01\/f6188dc824edb1127b65b952c5f0e073.js\"><\/script><\/p>\n\n\n\n<p>In <code>voicechatproject_scheduler.conf<\/code> we have written the following code.<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/MeetParikh01\/04aecb752efc361cb7dbdae069a5339f.js\"><\/script><\/p>\n\n\n\n<p>Basically, these supervisor configuration files tell the supervisor how to run and manage our \u2018programs\u2019 (as they are called by supervisord).<\/p>\n\n\n\n<p>Now just copy these files to the remote server in the <code>\u201c\/etc\/supervisor\/conf.d\/\u201d<\/code> directory.<\/p>\n\n\n\n<p>We also need to create the log files that are mentioned in the above scripts on the remote server:<\/p>\n\n\n\n<p><code>$ touch \/var\/log\/celery\/voicechatproject_worker.log<\/code><br><code>$ touch \/var\/log\/celery\/voicechatproject_beat.log<\/code><\/p>\n\n\n\n<p>Finally, run the following commands to make Supervisor aware of the programs &#8211; e.g., <code>voicechatproject_celery_worker<\/code> and <code>voicechatproject_celery_beat<\/code>:<\/p>\n\n\n\n<p><code>$ sudo supervisorctl reread<\/code><br><code>$ sudo supervisorctl update<\/code><\/p>\n\n\n\n<p>Run the following commands to stop, start, and\/or check the status of the program:<\/p>\n\n\n\n<p><code>Voicechatproject_celery_worker<\/code><br><code>voicechatproject_celery_worker<\/code><br><code>$ sudo supervisorctl stop<\/code><br><code>$ sudo supervisorctl start voicechatproject_celery_worker<\/code><br><code>$ sudo supervisorctl status voicechatproject_celery_worker<\/code><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Read more: <a href=\"https:\/\/www.botreetechnologies.com\/blog\/pros-and-cons-of-python\/\" target=\"_blank\" rel=\"noreferrer noopener\">Pros and Cons of Python: A Definitive Python Web Development Guide<\/a><\/strong><\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion:<\/h2>\n\n\n\n<p>Celery is extremely useful in Django development for background task processing. It allows you to keep time-consuming and non-immediate tasks outside the request time.<\/p>\n\n\n\n<p>Celery is also a useful package to execute long-running tasks in the background with the help of workers.&nbsp; It enables you to focus on the important tasks and keep the non-essential tasks in the background.<\/p>\n\n\n\n<p>I hope that this blog serves as a good introduction to implementing Celery in Django application and helps you save time on background task processing.<\/p>\n\n\n\n<p><strong><a href=\"https:\/\/www.botreetechnologies.com\/contact\" target=\"_blank\" rel=\"noopener noreferrer\">Consulting is free<\/a>&nbsp;\u2013 let us help you grow!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the initial stages, Django web development starts really simple&#8230;.<\/p>\n","protected":false},"author":59,"featured_media":13006,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68,70,10],"tags":[],"class_list":["post-10830","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-django","category-python","category-technology"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Implementing Celery using Django for Background Task Processing<\/title>\n<meta name=\"description\" content=\"Django involves a lot of background tasks. By implementing Celery in Django development, you can complete the time-consuming, non-essential tasks with the help of workers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Implementing Celery using Django for Background Task Processing\" \/>\n<meta property=\"og:description\" content=\"Django involves a lot of background tasks. By implementing Celery in Django development, you can complete the time-consuming, non-essential tasks with the help of workers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/\" \/>\n<meta property=\"og:site_name\" content=\"BoTree Technologies\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/BoTreeTechnologies\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-24T05:47:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-13T12:12:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/06\/implementing-celery-using-django-for-background-task-processing.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1280\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Meet Parikh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@BoTreeTech\" \/>\n<meta name=\"twitter:site\" content=\"@BoTreeTech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Meet Parikh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/\"},\"author\":{\"name\":\"Meet Parikh\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/a60c2fb00a6cd677895178853ab5d162\"},\"headline\":\"Implementing Celery using Django for Background Task Processing\",\"datePublished\":\"2020-06-24T05:47:58+00:00\",\"dateModified\":\"2021-09-13T12:12:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/\"},\"wordCount\":1364,\"commentCount\":13,\"image\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/06\/implementing-celery-using-django-for-background-task-processing.jpg\",\"articleSection\":[\"Django\",\"Python\",\"Technology\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/\",\"name\":\"Implementing Celery using Django for Background Task Processing\",\"isPartOf\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/06\/implementing-celery-using-django-for-background-task-processing.jpg\",\"datePublished\":\"2020-06-24T05:47:58+00:00\",\"dateModified\":\"2021-09-13T12:12:30+00:00\",\"author\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/a60c2fb00a6cd677895178853ab5d162\"},\"description\":\"Django involves a lot of background tasks. By implementing Celery in Django development, you can complete the time-consuming, non-essential tasks with the help of workers.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#primaryimage\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/06\/implementing-celery-using-django-for-background-task-processing.jpg\",\"contentUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/06\/implementing-celery-using-django-for-background-task-processing.jpg\",\"width\":1920,\"height\":1280,\"caption\":\"Celery using Django\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.botreetechnologies.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Implementing Celery using Django for Background Task Processing\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#website\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/\",\"name\":\"BoTree Technologies\",\"description\":\"Committed to inspire generation.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.botreetechnologies.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/a60c2fb00a6cd677895178853ab5d162\",\"name\":\"Meet Parikh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/meet-parikh-150x150.png\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/meet-parikh-150x150.png\",\"contentUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/meet-parikh-150x150.png\",\"caption\":\"Meet Parikh\"},\"description\":\"I am a passionate Python developer who is enthusiastic for working on web development using Django, machine learning and data science projects. I love to explore new technologies and apart from it i like to listen music, play computer and mobile games.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Implementing Celery using Django for Background Task Processing","description":"Django involves a lot of background tasks. By implementing Celery in Django development, you can complete the time-consuming, non-essential tasks with the help of workers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/","og_locale":"en_US","og_type":"article","og_title":"Implementing Celery using Django for Background Task Processing","og_description":"Django involves a lot of background tasks. By implementing Celery in Django development, you can complete the time-consuming, non-essential tasks with the help of workers.","og_url":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/","og_site_name":"BoTree Technologies","article_publisher":"https:\/\/www.facebook.com\/BoTreeTechnologies\/","article_published_time":"2020-06-24T05:47:58+00:00","article_modified_time":"2021-09-13T12:12:30+00:00","og_image":[{"width":1920,"height":1280,"url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/06\/implementing-celery-using-django-for-background-task-processing.jpg","type":"image\/jpeg"}],"author":"Meet Parikh","twitter_card":"summary_large_image","twitter_creator":"@BoTreeTech","twitter_site":"@BoTreeTech","twitter_misc":{"Written by":"Meet Parikh","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#article","isPartOf":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/"},"author":{"name":"Meet Parikh","@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/a60c2fb00a6cd677895178853ab5d162"},"headline":"Implementing Celery using Django for Background Task Processing","datePublished":"2020-06-24T05:47:58+00:00","dateModified":"2021-09-13T12:12:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/"},"wordCount":1364,"commentCount":13,"image":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#primaryimage"},"thumbnailUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/06\/implementing-celery-using-django-for-background-task-processing.jpg","articleSection":["Django","Python","Technology"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/","url":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/","name":"Implementing Celery using Django for Background Task Processing","isPartOf":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#primaryimage"},"image":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#primaryimage"},"thumbnailUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/06\/implementing-celery-using-django-for-background-task-processing.jpg","datePublished":"2020-06-24T05:47:58+00:00","dateModified":"2021-09-13T12:12:30+00:00","author":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/a60c2fb00a6cd677895178853ab5d162"},"description":"Django involves a lot of background tasks. By implementing Celery in Django development, you can complete the time-consuming, non-essential tasks with the help of workers.","breadcrumb":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#primaryimage","url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/06\/implementing-celery-using-django-for-background-task-processing.jpg","contentUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/06\/implementing-celery-using-django-for-background-task-processing.jpg","width":1920,"height":1280,"caption":"Celery using Django"},{"@type":"BreadcrumbList","@id":"https:\/\/www.botreetechnologies.com\/blog\/implementing-celery-using-django-for-background-task-processing\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.botreetechnologies.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Implementing Celery using Django for Background Task Processing"}]},{"@type":"WebSite","@id":"https:\/\/www.botreetechnologies.com\/blog\/#website","url":"https:\/\/www.botreetechnologies.com\/blog\/","name":"BoTree Technologies","description":"Committed to inspire generation.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.botreetechnologies.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/a60c2fb00a6cd677895178853ab5d162","name":"Meet Parikh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/meet-parikh-150x150.png","url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/meet-parikh-150x150.png","contentUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/meet-parikh-150x150.png","caption":"Meet Parikh"},"description":"I am a passionate Python developer who is enthusiastic for working on web development using Django, machine learning and data science projects. I love to explore new technologies and apart from it i like to listen music, play computer and mobile games."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/10830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/users\/59"}],"replies":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=10830"}],"version-history":[{"count":4,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/10830\/revisions"}],"predecessor-version":[{"id":16294,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/10830\/revisions\/16294"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/media\/13006"}],"wp:attachment":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=10830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=10830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=10830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}