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 | |
from django.template import add_to_builtins | |
import django.template.loader | |
try: | |
for lib in settings.TEMPLATE_TAGS: | |
add_to_builtins(lib) | |
except AttributeError: | |
pass |
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
# %(mysite)s - run %(mysite)s instances (default is the main production instance) | |
# | |
# This runs gunicorn-django for %(mysite)s; to install: | |
# * sudo ln -s <this file> /etc/init/%(mysite)s | |
# * sudo initctl reload-configuration | |
# | |
# it expects the following directory layout: | |
# | |
# /home/%(mysite)s/public_html | |
# \-env -> virtualenv |
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
import redis | |
from django.conf import settings | |
from django.core.signals import request_finished | |
try: | |
from eventlet.corolocal import local | |
except ImportError: | |
from threading import local |
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
#!/sbin/runscript | |
# Gunicorn init.d script for gentoo | |
# Written by Wojtek 'suda' Siudzinski <[email protected]> | |
# Gist: https://gist.github.com/748335 | |
# | |
# Sample config (/etc/conf.d/gunicorn): | |
# | |
# SERVERS=( | |
# 'server_name port project_path number_of_workers' |
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/sh | |
### BEGIN INIT INFO | |
# Provides: gunicorn | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the gunicorn server | |
# Description: starts gunicorn using start-stop-daemon |
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.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( |
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
import sys | |
import logging | |
from optparse import make_option | |
from django.core.management.base import BaseCommand, CommandError | |
class Command(BaseCommand): | |
help = ("Invalidates portions of the queryset cache based on the app names" | |
" or models provided as arguments to the command. If no arguments " | |
"are provided, nothing is done. To clear the entire queryset " |
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
import logging | |
from celery.signals import task_postrun | |
from celery.task import task | |
from haystack import site | |
def bounce_worker_after(func): | |
""" | |
A decorator which will ensure that the celery worker is shutdown (and subsequently restarted by celery) | |
after this task is executed. |
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/sh | |
### BEGIN INIT INFO | |
# Provides: gunicorn-graphite | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Should-Start: $nginx | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: gunicorn + nginx ubuntu init script | |
# Description: gunicorn + nginx ubuntu init script |
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
""" | |
Celery base task aimed at longish-running jobs that return a result. | |
``AwesomeResultTask`` adds thundering herd avoidance, result caching, progress | |
reporting, error fallback and JSON encoding of results. | |
""" | |
from __future__ import division | |
import logging | |
import simplejson |
OlderNewer