heroku.yml:
Код: Выделить всё
setup:
addons:
- plan: heroku-postgresql
- plan: heroku-redis
build:
docker:
web: Dockerfile
celery: Dockerfile
release:
image: web
command:
- python manage.py collectstatic --noinput
run:
web: gunicorn mysite.wsgi
celery: celery -A mysite worker --loglevel=info
Код: Выделить всё
from celery.result import AsyncResult
task = transcribe_file_task.delay(file_path, audio_language, output_file_type, 'ai_transcribe_output', session_id)
Код: Выделить всё
from celery import Celery
app = Celery('transcribe')#
@app.task
def transcribe_file_task(path, audio_language, output_file_type, dest_dir, session_id):
print(str("TASK: "+session_id))
#rest of code
return output_file
Код: Выделить всё
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from django.conf import settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
app = Celery("mysite")
app.config_from_object("django.conf:settings", namespace="CELERY")
app.autodiscover_tasks()
Подробнее здесь: https://stackoverflow.com/questions/790 ... -on-heroku