Anton Shestakov <av6@dwimlabs.net>, Fri, 05 Aug 2016 15:39:05 +0800
checker: use candolint.yml if it's found in project's root directory
viewer.py
Permissions: -rwxr-xr-x
from __future__ import absolute_import from tornado.ioloop import IOLoop from tornado.options import define, options from tornado.web import Application from candolint import uimodules from candolint.handlers import IndexHandler, ProjectHandler, CheckHandler, StatusHandler, ErrorHandler from candolint.models import database from candolint.utils import rel define('listen', metavar='IP', default='127.0.0.1') define('port', metavar='PORT', default=8033, type=int) define('xheaders', metavar='True|False', default=False, type=bool) define('debug', metavar='True|False', default=False, type=bool) class CandolintViewer(Application): project_re = r'/([.a-z0-9_-]+)/([^/]+)/([^/]+)' (project_re, ProjectHandler), (project_re + r'/([\d]+|latest)(?:/(raw))?', CheckHandler), (project_re + r'/status\.svg', StatusHandler), (r'.*', ErrorHandler, {'status_code': 404}) static_path=rel('static'), template_path=rel('templates'), super(CandolintViewer, self).__init__(handlers, **settings) logging.getLogger('peewee').setLevel(logging.DEBUG) database.init(rel('database.sqlite')) def listen(self, port, address='', **kwargs): name = self.__class__.__name__ logging.info('%s is serving on http://%s:%d/', name, address, port) super(CandolintViewer, self).listen(port, address, **kwargs) options.parse_command_line() application = CandolintViewer() application.listen(options.port, options.listen, xheaders=options.xheaders) if __name__ == '__main__':