托管一个在pythonany使用redis的Django项目

时间:2016-08-17 15:35:13

标签: django redis pythonanywhere

我在我的本地笔记本电脑上开发了一个电子商务网站,该项目使用redis,当我从localhost运行该项目时,它可以完美地使用以下工具 r = redis.StrictRedis(host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB)

REDIS_HOST = 'localhost'
REDIS_PORT = 6379
REDIS_DB = 1

现在,我试图将项目部署到任何地方的python。我已经安装了redis并启动了服务器,将localhost更改为myhost.pythonanywhere.com但是当我运行访问该网站时,我收到以下错误:

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

有人可以帮助我。什么是正确的配置。

1 个答案:

答案 0 :(得分:3)

Redis无法在PythonAnywhere上运行。