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
application: APP_ID | |
version: 1 | |
runtime: python | |
api_version: 1 | |
default_expiration: "60d" | |
handlers: | |
- url: /favicon\.ico | |
static_files: build/favicon.ico |
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
web: python manage.py run_gunicorn -b 0.0.0.0:$PORT -c config/gunicorn.conf --settings $DJANGO_SETTINGS_MODULE |
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 import template | |
import urllib, hashlib | |
register = template.Library() | |
@register.simple_tag(takes_context=True) | |
def gravatar_image_url(context, email, default='mm', size=40, extension='jpg', force_default=False, rating='g'): | |
return '{host}/avatar/{hash}.{extension}?{params}'.format( | |
host='https://secure.gravatar.com' or '//www.gravatar.com', |
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
mkdir -p MYBUCKET && mountpoint -q MYBUCKET || s3fs MYBUCKET MYBUCKET -o use_cache=/tmp -o use_rrs=1 |
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.models import Q | |
#from django.template.loader import render_to_string | |
#from django.http import HttpResponse | |
#from django.utils.cache import add_never_cache_headers | |
#from django.utils import simplejson | |
class DataTablesMixin(object): |
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 mongoengine.fields import GenericEmbeddedDocumentField as MDBGenericEmbeddedDocumentField | |
class GenericEmbeddedDocumentField(MDBGenericEmbeddedDocumentField): | |
def __init__(self, *args, **kwargs): | |
self.cls_field = kwargs.pop('cls_field', '_cls') | |
super(GenericEmbeddedDocumentField, self).__init__(*args, **kwargs) | |
def to_python(self, value): | |
cls = None | |
if isinstance(self.cls_field, (str, unicode)): |
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
-- Trigger: auto_create_schema on landlord_tenant | |
-- DROP TRIGGER auto_create_schema ON landlord_tenant; | |
CREATE TRIGGER auto_create_schema | |
AFTER INSERT | |
ON landlord_tenant | |
FOR EACH ROW | |
EXECUTE PROCEDURE create_schema(); |
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.core.exceptions import MiddlewareNotUsed | |
SSLIFY_ENABLED = getattr(settings, 'SSLIFY_ENABLED', not settings.DEBUG) | |
SSLIFY_HSTS_AGE = int(getattr(settings, 'SSLIFY_HSTS_AGE', 60 * 60 * 24 * 365)) | |
SSLIFY_INCLUDE_SUBDOMAINS = getattr(settings, 'SSLIFY_INCLUDE_SUBDOMAINS', False) | |
SSLIFY_PERMANENT = getattr(settings, 'SSLIFY_PERMANENT', False) | |
if SSLIFY_PERMANENT: | |
from django.http import HttpResponsePermanentRedirect as HttpResponseClass |
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 | |
# Procedure | |
# 1. Stop instance | |
# 2. Detach volume | |
# 3. Make Snapshot | |
# 4. Make new volume from snapshop with new size | |
# 5. Attach volume to instance | |
# 6. Start instance | |
instanceid=INSTANCE_TO_RESIZE |
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
forwarded_allow_ips = '*' | |
x_forwarded_for_header = 'X-FORWARDED-FOR' | |
secure_scheme_headers = { | |
'X-FORWARDED-PROTO': 'https', | |
} |