Desire is an Invitation

Sitting around waiting for what you want is a waste of time. And since time is your most valuable currency, it should be well-spent. Desire is an invitation. When you feel the pull, you know life has…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Python Celery Asynchronous Tasks with RabbitMQ Broker

Running asynchronous task with Celery Worker and RabbitMQ. It strongly recommended for long running tasks.

Prerequisite:
RabbitMQ Server (localhost, heroku or other rabbitmq server)

Step 1: Preparation
create virtualenv: virtualenv venv
start virtualenv: venv/Scripts/activate
install celery in virtualenv: pip install celery sqlalchemy eventlet
Create App Folder: mkdir app
Go to myproject folder: cd app

Step 2: Create tasks.py file

Step 3: Run celery worker

Open new cmd/terminal and go to virtualenv shell follow with python shell
start virtualenv: venv/Scripts/activate
Go to myproject folder: cd app
Run celery worker with following command: celery -A tasks worker — loglevel=info -P eventlet

Celery Worker Run

Step 4: Send message task to queued and let celery worker run

Open new cmd/terminal and go to virtualenv shell follow with python shell
start virtualenv: venv/Scripts/activate
Go to myproject folder: cd app
Go to python shell: python

Add a comment

Related posts:

Future of Digital Currency

Over the last year or more the focus of the cryptocurrency world has been on the collapse of crypto businesses, the plunge of crypto token values, and cases of fraud at the heart of major…

On Metrics

We might often lose the sense of progress made so far. Our initial motivation evaporates. Or we cling too much, forcing ourselves into futile catatonia. Proper evaluation of success has a direct…

Looking Ahead By Glancing Back

We have so many big things brewing, it’s hard not to look ahead to all of the things FansUnite will accomplish in 2019. But first, a quick look back on how we got where we are today. The only people…