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 collections import defaultdict | |
import gc | |
class MemoryProfilingMiddleware(object): | |
def __init__(self, app): | |
self.app = app | |
#gc.set_debug(gc.DEBUG_LEAK) | |
self.last_count = 0 |
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
""" | |
`appengine_config.py` gets loaded every time a new instance is started. | |
Use this file to configure app engine modules as defined here: | |
https://developers.google.com/appengine/docs/python/tools/appengineconfig | |
""" | |
def add_vendor_packages(vendor_folder): | |
""" |
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 | |
from gevent import monkey | |
monkey.patch_all() | |
monkey.patch_sys(stdin=True, stdout=False, stderr=False) | |
import gevent | |
from gevent.queue import Queue | |
import sys | |
import signal |
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 | |
from gevent import monkey | |
monkey.patch_all() | |
monkey.patch_sys(stdin=True, stdout=False, stderr=False) | |
import gevent | |
from gevent.queue import Queue | |
import signal | |
import sys | |
from socketio.namespace import BaseNamespace |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<script src="/static/socket.io.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script> | |
<script> | |
angular.module('app', []) | |
.controller('logs', function($scope){ |
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
function flatten_generic_value(val){ | |
if(val.type === 'container'){ | |
return flatten_generic(val['container_value']); | |
} else if(val.type === 'list'){ | |
return val.list_value.map(flatten_generic_value); | |
} else { | |
return val[val.type + '_value']; | |
} | |
}; |
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 raven.handlers.logging import SentryHandler | |
from raven.conf import setup_logging | |
import logging | |
handler = SentryHandler('sentry dsn here') | |
setup_logging(handler) | |
console = logging.StreamHandler() | |
console.setLevel(logging.INFO) | |
formatter = logging.Formatter('%(asctime)-12s: %(levelname)-8s: %(message)s', datefmt='%m-%d %H:%M') |
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_config | |
if __name__ == '__main__': | |
try: | |
do_stuff() | |
except Exception as e: | |
logging.exception(e) | |
raise |
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: your-app-id | |
version: 1 | |
runtime: python27 | |
threadsafe: true | |
api_version: 1 | |
module: api | |
handlers: | |
# Endpoints handler | |
- url: /_ah/spi/.* |
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
# Dockerfile extending the generic Python image with application files for a | |
# single application. | |
FROM google/appengine-python27 | |
ADD requirements.txt /app/ | |
RUN pip install -r requirements.txt | |
ADD . /app |
OlderNewer