Example #1
0
 def run_gen(self):
     """Generates the static site."""
     if not CONFIG.SITE.ENGINES:
         message = "All engines are inactive -- nothing to generate."
         console(message, is_bright=True, color='red')
     else:
         generator.run()
Example #2
0
    def process_request(self, request, client_address):
        """Finishes one request by instantiating the handler class.

        Prior to handler class initialization, this method checks the latest
        timestamp of all directories inside the Volt project. If the result
        is higher than the prior timestamp (self.last_mtime), then the entire
        site will be regenerated.

        """
        latest_mtime = self.check_dirs_mtime()

        if self.last_mtime < latest_mtime:
            message = "Source file modification detected -- regenerating site"
            console(message, color='yellow')
            self.logger.debug(message)

            self.last_mtime = latest_mtime
            CONFIG.reset()
            generator.run()
            self.logger.debug('done: regenerating site')

        ThreadingTCPServer.process_request(self, request, client_address)