-
Install redis on OSX (10.7) Lion I used:
$ brew install redis
-
In the project and virtualenv I wanted to use django-celery in I installed the following.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if is_paginated %} | |
<div class="pagination"> | |
<ul> | |
{% if page_obj.has_previous %} | |
<li><a href="?page={{ page_obj.previous_page_number }}"> | |
{% else %} | |
<li class="disabled"><a href="#"> | |
{% endif %} | |
Prev</a></li> | |
{% for p in page_obj.paginator.page_range %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example logging configuration that will restrict console logging to | |
# at most 2 repeated messages per 30 seconds. | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'formatters': { | |
'simple': { | |
'format': '%(asctime)s - %(name)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s' | |
}, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
import re | |
class SubdominiosMiddleware: | |
def process_request(self, request): | |
request.domain = request.META['HTTP_HOST'] | |
request.subdomain = '' | |
parts = request.domain.split('.') | |
if len(parts) == 3 or (re.match("^localhost", parts[-1]) and len(parts) == 2): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.utils import timezone | |
from django.contrib.auth.models import (AbstractBaseUser, | |
BaseUserManager as DjBaseUserManager) | |
from model_utils.managers import InheritanceManager | |
class BaseUserManager(DjBaseUserManager, InheritanceManager): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#update an A record in digital Ocean. Dynamic DNS style. | |
#API info here: | |
#https://developers.digitalocean.com/#domains-list | |
#your domain ID | |
domain_id="XXX" | |
#record to update | |
record_id="XXX" | |
#digitalocean client_id |
Related tutorial: http://cd64.de/mysql-cli
SQL joins infografic: http://cd64.de/sql-joins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# install pyftpdlib | |
# (shell) > easy_install https://pyftpdlib.googlecode.com/files/pyftpdlib-1.0.1.tar.gz | |
# tutorial | |
# https://code.google.com/p/pyftpdlib/wiki/Tutorial | |
from pyftpdlib.authorizers import DummyAuthorizer | |
from pyftpdlib.handlers import FTPHandler |
NewerOlder