def run_collectstatic(self):
        """Collects static files and copies them to compiledir"""

        # FIXME: rewrite using tools.get_static_files(cfg)

        cfg = self._request.get_configuration()

        self.initialize()

        # Copy over static files
        print 'Copying over static files ...'
        dst = os.path.join(cfg['compiledir'], 'static')
        if not os.path.exists(dst):
            os.makedirs(dst)

        def notifyfun(filename):
            print '   Copying {0}'.format(filename)

        # Copy over static_files_dirs files first
        static_files_dirs = cfg['static_files_dirs']
        static_files_dirs.append(os.path.join(cfg['datadir'], '..', 'static'))
        for mem in static_files_dirs:
            tools.copy_dir(mem, dst, notifyfun=notifyfun)

        # Copy over themes static dirs
        for mem in os.listdir(cfg['themedir']):
            path = os.path.join(cfg['themedir'], mem, 'static')
            if os.path.exists(path):
                tools.copy_dir(path, dst, notifyfun=notifyfun)

        # We're done, clean up
        self.cleanup()