Skip to content

Instantly share code, notes, and snippets.

# This is a hack to patch slow socket.getfqdn calls that
# BaseHTTPServer (and its subclasses) make.
# See: http://bugs.python.org/issue6085
# See: http://www.answermysearches.com/xmlrpc-server-slow-in-python-how-to-fix/2140/
import BaseHTTPServer
def _bare_address_string(self):
host, port = self.client_address[:2]
return str(host)
import re
import urllib
from tornado.web import RequestHandler
#CAS setting
CAS_SETTINGS = {
#replace this with your cas server url
'cas_server' : 'http://cas_server',
#replace this with your website url
'service_url' : 'http://service_url/deal_with_st',
@iOS0x00
iOS0x00 / server.py
Created October 23, 2013 08:10 — forked from omarish/server.py
import tornado.web
class NoCacheStaticFileHandler(tornado.web.StaticFileHandler):
def set_extra_headers(self, path):
self.set_header("Cache-control", "no-cache")
class Application(tornado.web.Application):
def __init__(self):
handlers = [
# ...