This file contains hidden or 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.http import HttpResponsePermanentRedirect | |
from django.utils import six | |
def enforce_hostname(get_response): | |
""" | |
Enforce the hostname per the ENFORCE_HOSTNAME setting in the project's settings | |
The ENFORCE_HOSTNAME can either be a single host or a list of acceptable hosts | |
""" |
This file contains hidden or 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 | |
""" | |
Provide useful alembic information after switching branches. | |
""" | |
import argparse | |
import subprocess | |
import os | |
import os.path | |
import py.path |
This file contains hidden or 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 | |
""" | |
no more embarrasing "removed pdb, sorry" commits | |
install | |
------- | |
save it as .git/hooks/pre-commit giving +x permission | |
""" |
This file contains hidden or 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
# python (django) side: | |
from django.http import StreamingHttpResponse | |
import time | |
def stream(request): | |
def event_stream(): | |
while True: | |
time.sleep(3) | |
yield 'data: %s\n\n' % 'hola mundo' |
This file contains hidden or 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 -*- | |
""" | |
Script to run pep8 and pyflakes via git's pre-commit hook | |
Based on https://github.com/lbolla/dotfiles/blob/master/githooks/pre-commit | |
Modified by Martin Gaitán <[email protected]> for Machinalis (www.machinalis.com) | |
Install: |