def start_server(debug=False): message = 'Starting server at http://%s:%s' % (HOST, PORT) if debug: variables = settings.theme.get('vars', {}) variables.update({'debug': True}) settings.theme['vars'] = variables if RequestHandler is object: logging.info(message) make_server(HOST, int(PORT), wsgi_app).serve_forever() else: import tornado.web if g.output_directory == ROOT: #: if this is a liquidluck project, build the site load_posts(settings.config['source']) write_posts() logging.info('Theme directory: %s' % g.theme_directory) handlers = [ (r'/livereload', LiveReloadHandler), (r'/livereload.js', LiveReloadJSHandler), (r'/theme/(.*)', ThemeStaticHandler), (r'(.*)', IndexHandler), ] app = tornado.web.Application(handlers=handlers, default_host=HOST) app.listen(int(PORT)) logging.info(message) tornado.ioloop.IOLoop.instance().start()
def start_server(): if RequestHandler is object: logging.info('Start server at 0.0.0.0:%s' % PORT) make_server('', PORT, wsgi_app).serve_forever() else: import tornado.web if g.output_directory == ROOT: #: if this is a liquidluck project, build the site load_posts(settings.source) write_posts() logging.info('Theme directory: %s' % g.theme_directory) handlers = [ (r'/livereload', LiveReloadHandler), (r'/livereload.js', LiveReloadJSHandler), (r'(.*)', IndexHandler), ] app = tornado.web.Application(handlers=handlers) app.listen(PORT) logging.info('Start server at 0.0.0.0:%s' % PORT) tornado.ioloop.IOLoop.instance().start()
def watch_tasks(self): if g.output_directory != ROOT: # not a liquidluck project if self._is_changed(ROOT): self.reload_browser() return if self._is_changed(g.source_directory): # clean posts g.public_posts = [] g.secure_posts = [] g.pure_files = [] g.pure_pages = [] load_posts(settings.config['source']) write_posts() self.reload_browser() if self._is_changed(g.theme_directory): write_posts() self.reload_browser()
def start_server(): if RequestHandler is object: logging.info('Start server at %s:%s' % (HOST, PORT)) make_server(HOST, int(PORT), wsgi_app).serve_forever() else: import tornado.web if g.output_directory == ROOT: #: if this is a liquidluck project, build the site load_posts(settings.config['source']) write_posts() logging.info('Theme directory: %s' % g.theme_directory) handlers = [ (r'/livereload', LiveReloadHandler), (r'/livereload.js', LiveReloadJSHandler), (r'/theme/(.*)', ThemeStaticHandler), (r'(.*)', IndexHandler), ] app = tornado.web.Application(handlers=handlers, default_host=HOST) app.listen(int(PORT)) logging.info('Start server at %s:%s' % (HOST, PORT)) tornado.ioloop.IOLoop.instance().start()
def watch_tasks(self): if g.output_directory != ROOT: # not a liquidluck project if self._is_changed(ROOT): self.reload_browser() return if self._is_changed(g.source_directory, 4): # clean posts g.public_posts = [] g.secure_posts = [] g.pure_files = [] g.pure_pages = [] load_posts(settings.config['source']) write_posts() self.reload_browser() if self._is_changed(g.theme_directory): write_posts() self.reload_browser()
def test_load_posts(): load_posts(os.path.join(ROOT, 'source/post')) from liquidluck.options import g assert len(g.public_posts) > 0