A
A
AntonIgin2017-08-29 00:50:45
Django
AntonIgin, 2017-08-29 00:50:45

How to launch Celery immediately with virtual environment?

The problem is the following: when I start the worker simply in the console, many tasks are not displayed, because have dependencies with packages not installed outside of the defined virtual environment. But once you connect to it and try again, the problem is fixed.
How to avoid this problem in production? I don't want to put all the packages on the system, that is, to refuse the virtual environment altogether. What options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Kuzmichev, 2017-08-29
@AntonIgin

Well, you probably have a file with dependencies in your project. requirements.txt, For example. Where, among other dependencies, the celery of the desired version should also be registered:

..
celery==X.Y.Z 
..

On prod, one of the steps in your release process is probably to install/upgrade these dependencies:
Therefore, you have celery installed on your venv. Probably .
Well, just run it from there, and that's it. You can do it the same way, just the path to the executable file will point inside your virtual environment with the project, like:
/path/to/virtualenv/bin/celery --params ....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question