I am running a Django server with redis [in-memory caching to filter duplicate entries] integrated into the celery process [tasks that insert data into the PostgreSQL database asynchronously]. The django server is integrated with redis through django-redis-cachewith caching enabled.
CACHES = {
'default': {
'BACKEND': 'redis_cache.RedisCache',
'LOCATION': '/tmp/redis.sock',
},
}
If I use ./manage.py runserver ip:8000to start my server and start publishing data, there are no problems in the GET / SET attributes in redis, as this is one application and my application runs smoothly.
But now I plan to port django to gunicornusing this command:
gunicorn myapp:wsgi_app -w 3 -b ip:8000
Since this creates 3 workers for the django process, I believe that they are trying to access the same redis server for caching.
, ,
Internal Server Error: /post/data/
File "/path/to/app/views.py", line 94, in saveData
value = cache.get(key)
File "/usr/local/lib/python2.7/dist-packages/redis_cache/cache.py", line 186, in get
result = self.unpickle(value)
File "/usr/local/lib/python2.7/dist-packages/redis_cache/cache.py", line 248, in unpickle
return pickle.loads(value)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 1035, in model_unpickle
return cls.__new__(cls)
TypeError: ('object.__new__(X): X is not a type object (NoneType)', <function model_unpickle at 0x1c49aa0>, ((u'webapi', 'Reading'), [], <function simple_class_factory at 0x1c49a28>))
redis-server [ redis-cli monitor], , gunicorn.
, redis ?