def make_app(): application = URLDispatcher() js_app = DirectoryApp(os.path.join(here, 'static/js')) css_app = DirectoryApp(os.path.join(here, 'static/css')) img_app = DirectoryApp(os.path.join(here, 'static/img')) application.add_url('js', '/js/*', js_app) application.add_url('css', '/css/*', css_app) application.add_url('img', '/img/*', img_app) application.add_url('page', '/{page_name}', page_view) application.add_url('page_edit', '/{page_name}/edit', page_edit) application.add_url('top', '/', HTTPFound(location='FrontPage')) return application
if address == "NONE": return [b"Hi"] if int(address) > 0 and int(address) < 255: call_powerwake(address) return [b'success to wake'] return [b"fail to wake"] def call_powerwake(octed): args = shlex.split(CMD_LINE + octed) # print (args) subprocess.call(args) return def run(): server = simple_server.make_server('', SERVER_PORT, app) server.serve_forever() return from webdispatch import URLDispatcher app = URLDispatcher() app.add_url(INDEX_NAME, '/' + INDEX_NAME, query_parse) run()