Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding:utf-8 -*-
- import redis
- from django.core.management.base import BaseCommand
- BLOG_LIST_KEY = 'mula2_blogs'
- class Command(BaseCommand):
- def handle(self, *args, **kwargs):
- # redis para blogs
- R = redis.StrictRedis('', 6379)
- blogs = set()
- while True:
- blog = R.lpop(BLOG_LIST_KEY)
- if blog is None:
- break
- else:
- blogs.add(blog)
- for blog in blogs:
- R.lpush(BLOG_LIST_KEY, blog)
Advertisement
Add Comment
Please, Sign In to add comment