title: Integrating redis with django
body: <p>I am newbie in Django. My task is design a backend where there will be login system (using the default user table provide by django). There are two other tables, one is the image table which has the imgvalue column which contains the key from redis database. The other table (imgacl), is to provide the access control to users for viewing the particular images which a required user has access. The redis database is actually storing the images with key-value pair, and that key is stored in the imgvalue column. Here are my codes:  </p>
  
  <p>models.py:</p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  
  # Create your models here.
  class Image(models.Model):
      imgvalue = models.Charfield(max_length =250)
  
  class Imageacl(models.Model):
      id = models.ForeignKey(Image,on_delete =models.CASCADE)
      userlist= models.Textfield(null=True)
  </code></pre>
  
  <p>The userlist contains the list of user which can see a particular image.
  A separate python program for storing 50 images in Redis db. Suppose there are 5 users, the user1 can view 10 images, users2 can view 15 images...</p>
  
  <pre><code>import redis
  from PIL import Image
  rd =  redis.StrictRedis()
  for x in range(1,51):
      img = open("{}.jpg".format(x),"rb").read()
      rd.set("key{}".format(x),img)
  </code></pre>
  
  <p>I have two questions:<br>
  1) How I wll integrate redis with django &amp;<br>
  2) How I will provide the access control to users??</p>