1. Josh VanderLinden
  2. pist

Source

pist / pist / server.py

#!/usr/bin/env python

from tornado import httpserver, ioloop
from tornado.options import define, options, parse_command_line

# ------ OPTIONS ------

define('port', default=80, type=int,
        help='Listen for traffic on the specified port')
define('template_path', default=None, type=str,
        help='Path to custom templates')
define('static_path', default=None, type=str,
        help='Path to custom static files')

def serve():
    from pist.application import PistApplication

    parse_command_line()

    pist = PistApplication(options.template_path, options.static_path)
    server = httpserver.HTTPServer(pist)
    server.listen(options.port)
    ioloop.IOLoop.instance().start()

if __name__ == '__main__':
    serve()