Search code examples
pythondjangorediscelerydjango-celery

How to get redis server working under virtualenv for mac users?


I have installed celery and redis using pip install redis celery within my virutalenv 'djangoscrape' . Typing redis-server -bash: redis-server: command not found. Please what am i doing wrong?

Also typing:

/Users/Me/.virtualenvs/djangoscrape/bin/celery --app=scraper.celery_tasks:app worker --loglevel=INFO

results in:

-------------- celery@MikkyPro v3.1.18 (Cipater)
---- **** ----- 
--- * ***  * -- Darwin-14.5.0-x86_64-i386-64bit
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .> app:         scraper:0x1084719d0
- ** ---------- .> transport:   redis://localhost:6379/0
- ** ---------- .> results:     djcelery.backends.database:DatabaseBackend
- *** --- * --- .> concurrency: 8 (prefork)
-- ******* ---- 
--- ***** ----- [queues]
 -------------- .> celery           exchange=celery(direct) key=celery


[tasks]


[2015-09-14 07:46:43,805: ERROR/MainProcess] consumer: Cannot connect to redis://localhost:6379/0: Error 61 connecting to localhost:6379. Connection refused..
Trying again in 2.00 seconds...

typing: which celery from command prompt in mac returns:

/Users/Me/.virtualenvs/djangoscrape/bin/celery

but which redis does nothing.

And pip install redis shows:

Requirement already satisfied (use --upgrade to upgrade): redis in /Users/Me/.virtualenvs/djangoscrape/lib/python2.7/site-packages


Solution

  • pip will only install the Python libraries for connecting to a redis database. You need to install the redis server itself: probably the easiest way to do that on a Mac is to use Homebrew.