triocandy.blogg.se

How to make a new file from a celery task
How to make a new file from a celery task











how to make a new file from a celery task

how to make a new file from a celery task

Decouple the logic from a view into a separate function generally suboptimal performance of the view which you can't improve. preparing a massive report involving complex or numerous queries on a large set of database rows Long time to generate a response can be taken by: Often view is expected to return a response in under 30 seconds tops.įor a number of reasons to generate a response your view might need some more time. Path('ckeditor/', include('ckeditor_uploader.urls')),Ĭreate a file myapp/templates/myapp/base.html with this content: Path('myapp/', include('myapp.urls')), # new In djangito/ urls.py add myapp urls to the root URLConf: from ntrib import admin Create an appĬreate an app myapp docker-compose run web python manage.py startapp myappĪdd it to installed apps in djangito/ settings.py to the list PROJECT_APPS:Ĭreate myapp/ urls.py with the following content: from django.urls import path You can explore Celery setup in djangito/ celeryapp.py and in Procfile where you find what commands are used to run Celery worker and scheduler.īy the way for scheduler we use celery-redbeat. The rest of the requirements you can find here: These are packages that we will be actively relying in this tutorial: Django=3.2.7 Let's start from getting fresh djangitos project template.

How to make a new file from a celery task code#

Repository with the source code for this tutorial: Setup the project

how to make a new file from a celery task

  • Use cache key to mark that celery task is already sent.
  • Use a cache key to not send_task if a celery task already running.
  • Generate report with a Celery task and caching.












  • How to make a new file from a celery task