How to connect to redis?
<pre><code>CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "redis://127.0.0.1:6379/1",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
        }
    }
}
</code></pre>

<p>I am trying to connect to redis to save my object in it, but it gives me this error when i try to connect</p>

<blockquote>
  <p>Error 10061 connecting to 127.0.0.1:6379. No connection could be made
  because the target machine actively refused it</p>
</blockquote>

<p>How does it work, what should i give in location and i am on a proxy from my company. Need some detailed explanation on location. </p>

<p>First start the redis server. Your OS will provide a mechanism to do that, e.g. on some Linuxes you could use <code>systemctl start redis</code>, or <code>/etc/init.d/redis start</code> or similar. Or you could just start it directly with:</p>

<pre><code>$ redis-server
</code></pre>

<p>which will run it as a foreground process.</p>

<p>Then try running the <code>redis-cli ping</code> command. Receiving a <code>PONG</code> response indicates that redis is in fact up and running on your local machine:</p>

<pre><code>$ redis-cli ping
PONG
</code></pre>

<p>Once you have that working try Django again.</p>

python django redis