Skip to content

Instantly share code, notes, and snippets.

View tyrchen's full-sized avatar

Tyr Chen tyrchen

View GitHub Profile
@tyrchen
tyrchen / README.md
Created November 7, 2012 00:33 — forked from dariocravero/README.md
Save files in Meteor

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

# UpYun storage for django, written by Tyr Chen @ tukeq.com
# to run this gist you need to get upyun python sdk first.
# upyun storage
class UpYunStorage(Storage):
def __init__(self, bucket=settings.UPYUN_BUCKET):
self.upyun = UpYun(bucket, settings.UPYUN_USERNAME, settings.UPYUN_PASSWORD)
self.upyun.setApiDomain(settings.UPYUN_API_DOMAIN)
self.binding_domain = settings.UPYUN_BINDING_DOMAIN

Django-celery + Redis notes

Installation and Setup

  1. Install redis on OSX (10.7) Lion I used:

     $ brew install redis
    
  2. In the project and virtualenv I wanted to use django-celery in I installed the following.

@tyrchen
tyrchen / redis_session_backend.py
Created December 5, 2011 09:14 — forked from mikeyk/redis_session_backend.py
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(