Beispiel #1
0
            'tools.staticdir.dir': os.path.join(html_dir, 'img')
        },
        '/js': {
            'tools.staticdir.on': True,
            'tools.staticdir.dir': os.path.join(html_dir, 'js')
        },
        '/favicon.png': {
            'tools.staticfile.on': True,
            'tools.staticfile.filename': os.path.join(html_dir, 'favicon.png')
        }
    }

    empty_conf = {'/': {}}
    try:
        cron_instance = cron(base_dir, cherrypy.config['server.commit_delay'])
    except KeyError:
        cron_instance = cron(base_dir, 10)
    finally:
        minute_crontab = cherrypy.process.plugins.Monitor(
            cherrypy.engine, cron_instance.check_interval, 60)
        minute_crontab.subscribe()

    cherrypy.tree.mount(mounts.Root(), web_root, config=root_conf)
    cherrypy.tree.mount(mounts.ViewModel(), web_root + 'vm', config=empty_conf)
    cherrypy.tree.mount(auth.AuthController(),
                        web_root + 'auth',
                        config=empty_conf)
    # os.system('sudo /usr/local/bin/mineos start')
    cherrypy.engine.start()
    cherrypy.engine.block()
Beispiel #2
0
    empty_conf = {'/': {}}

    try:
        cron_instance = cron(base_dir, cherrypy.config['server.commit_delay'])
    except KeyError:
        cron_instance = cron(base_dir, 10)
    finally:
        minute_crontab = cherrypy.process.plugins.Monitor(
            cherrypy.engine, cron_instance.check_interval, 60)
        minute_crontab.subscribe()

    import mounts, auth

    try:
        tally()
    except:
        pass

    try:
        cherrypy.config['misc.localization'] = str(
            cherrypy.config['misc.localization']).lower()
    except (KeyError, TypeError, AttributeError):
        cherrypy.config['misc.localization'] = 'en'

    cherrypy.tree.mount(mounts.Root(), "/", config=root_conf)
    cherrypy.tree.mount(mounts.ViewModel(), "/vm", config=empty_conf)
    cherrypy.tree.mount(auth.AuthController(), '/auth', config=empty_conf)
    cherrypy.engine.start()
    cherrypy.engine.block()
Beispiel #3
0
    empty_conf = {'/': {}}

    if args.daemon:
        from cherrypy.process.plugins import Daemonizer
        Daemonizer(cherrypy.engine).subscribe()

    if args.nopid is False:
        from cherrypy.process.plugins import PIDFile
        PIDFile(cherrypy.engine, '/var/run/mineos.pid').subscribe()

    if os.path.isfile('/var/run/mineos.pid'):
        import sys
        print 'MineOS instance already running (PID found)'
        sys.exit(1)

    minute_crontab = cherrypy.process.plugins.Monitor(
        cherrypy.engine,
        cron(base_dir).check_interval, 60)
    minute_crontab.subscribe()

    import mounts, auth

    cherrypy.config.update(global_conf)
    cherrypy.tree.mount(mounts.Root(html_dir, base_dir), "/", config=root_conf)
    cherrypy.tree.mount(mounts.ViewModel(base_dir), "/vm", config=empty_conf)
    cherrypy.tree.mount(auth.AuthController(html_dir),
                        '/auth',
                        config=empty_conf)
    cherrypy.engine.start()
    cherrypy.engine.block()