Search code examples
djangoredispythonanywhere

Hosting a Django project that uses redis on pythonanywhere


I developed an e-commerce site on my local laptop and the project uses redis and when I run the project from localhost, it works perfectly using the following r = redis.StrictRedis(host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB):

REDIS_HOST = 'localhost'
REDIS_PORT = 6379
REDIS_DB = 1

Now, I am trying to deploy the project to python anywhere. I have installed the redis and started the server, changed localhost to myhost.pythonanywhere.com but when I run visit the site I get the following error:

Error 111 connecting to 50.19.109.98:6379. Connection refused.
Request Method: GET
Request URL:    http://myhost.pythonanywhere.com/en/4/black-garbage-t-shirt/
Django Version: 1.8.3
Exception Type: ConnectionError
Exception Value:    
Error 111 connecting to 50.19.109.98:6379. Connection refused.
Exception Location: /home/dguy/dguy/venv/lib/python3.4/site-packages/redis/connection.py in connect, line 436
Python Executable:  /usr/local/bin/uwsgi
Python Version: 3.4.3
Python Path:    
['/var/www',
 '.',
 '',
 '/var/www',
 '/home/dguy/dguy/venv/lib/python3.4',
 '/home/dguy/dguy/venv/lib/python3.4/plat-x86_64-linux-gnu',
 '/home/dguy/dguy/venv/lib/python3.4/lib-dynload',
 '/usr/lib/python3.4',
 '/usr/lib/python3.4/plat-x86_64-linux-gnu',
 '/home/dguy/dguy/venv/lib/python3.4/site-packages',
 '/home/dguy/dguy',
 '/home/dguy']
Server time:    Wed, 17 Aug 2016 16:10:56 +0100

Can someone please help me. what are the right configuration.


Solution

  • Redis will not work on PythonAnywhere.