<commit_before>import os
import sys
import logging

from gist import app as gist
#from githubapp import app as github

from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop


if __name__ == '__main__':
    # Bind to PORT if defined, otherwise default to 5000.
    port = int(os.environ.get('PORT', 5000))
    debugfile = os.path.exists('.debug')
    debugenv = os.environ.get('DEBUG', '')
    debug = debugfile or debugenv
    print 'url scheme' , os.environ.get('URL_SCHEME', 'gist')
    if debug:
        print 'DEBUG MODE IS ACTIVATED !!!'

    urlscheme = os.environ.get('URLSCHEME', 'GIST')
    
    if not debug:
        log_level = getattr(logging, os.environ.get('LOG_LEVEL', 'WARN'))
        gist.logger.setLevel(log_level)
        handler = logging.StreamHandler(sys.stderr)
        handler.setLevel(log_level)
        handler.setFormatter(logging.Formatter(
            '[%(asctime)s] %(levelname)s: %(message)s '
        ))
        gist.logger.addHandler(handler)
        # gist.logger.addHandler(logging.StreamHandler())
    
    http_server = HTTPServer(WSGIContainer(gist))
    http_server.listen(port)
    IOLoop.instance().start()
    #gist.run(host='0.0.0.0', port=port, debug=debug)<commit_msg>try gzip<commit_after>import os
import sys
import logging

from gist import app as gist
#from githubapp import app as github

from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.web import FallbackHandler, Application
from tornado.ioloop import IOLoop


if __name__ == '__main__':
    # Bind to PORT if defined, otherwise default to 5000.
    port = int(os.environ.get('PORT', 5000))
    debugfile = os.path.exists('.debug')
    debugenv = os.environ.get('DEBUG', '')
    debug = debugfile or debugenv
    print 'url scheme' , os.environ.get('URL_SCHEME', 'gist')
    if debug:
        print 'DEBUG MODE IS ACTIVATED !!!'

    urlscheme = os.environ.get('URLSCHEME', 'GIST')
    
    if not debug:
        log_level = getattr(logging, os.environ.get('LOG_LEVEL', 'WARN'))
        gist.logger.setLevel(log_level)
        handler = logging.StreamHandler(sys.stderr)
        handler.setLevel(log_level)
        handler.setFormatter(logging.Formatter(
            '[%(asctime)s] %(levelname)s: %(message)s '
        ))
        gist.logger.addHandler(handler)
        # gist.logger.addHandler(logging.StreamHandler())


    wsgi_app = WSGIContainer(gist)
    application = Application([
        (r".*", FallbackHandler, dict(fallback=wsgi_app))
    ])
    application.settings['gzip']=True

    
    #http_server = HTTPServer(WSGIContainer(gist))
    application.listen(port)
    IOLoop.instance().start()
    #gist.run(host='0.0.0.0', port=port, debug=debug)
{'fraction_non_alphanumeric': 0.12418772563176896, 'fraction_numerical': 0.008664259927797834, 'mean_word_length': 3.356918238993711, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5458342', 'n_tokens_mistral': 925, 'n_tokens_neox': 904, 'n_words': 197}