def get_template_dirs(self):
        """
        Get templates directory from apps, but in reversed order, so the same named template
        file will be overrided by latter defined app
        """
        def if_not_empty(dir):
            if not os.path.exists(dir):
                return
            for root, dirs, files in os.walk(dir):
                if dirs:
                    return True
                for f in files:
                    if f != 'readme.txt':
                        return True
                    
        template_dirs = [os.path.join(self.project_dir, x) for x in settings.GLOBAL.TEMPLATE_DIRS or []]
        taglibs_dirs = []
        for p in reversed(self.apps):
            app_path = get_app_dir(p)
            path = os.path.join(app_path, 'templates')
            if if_not_empty(path):
                template_dirs.append(path)

            path = os.path.join(app_path, 'taglibs')
            if if_not_empty(path):
                taglibs_dirs.append(path)

        Dispatcher.template_dirs = template_dirs
        Dispatcher.taglibs_dirs = taglibs_dirs
def get_template_dirs ( self ) : def if_not_empty ( dir ) : if not os . path . exists ( dir ) : return for root , dirs , files in os . walk ( dir ) : if dirs : return True for f in files : if f != 'readme.txt' : return True template_dirs = [ os . path . join ( self . project_dir , x ) for x in settings . GLOBAL . TEMPLATE_DIRS or [ ] ] taglibs_dirs = [ ] for p in reversed ( self . apps ) : app_path = get_app_dir ( p ) path = os . path . join ( app_path , 'templates' ) if if_not_empty ( path ) : template_dirs . append ( path ) path = os . path . join ( app_path , 'taglibs' ) if if_not_empty ( path ) : taglibs_dirs . append ( path ) Dispatcher . template_dirs = template_dirs Dispatcher . taglibs_dirs = taglibs_dirs
Get templates directory from apps, but in reversed order, so the same named template
        file will be overrided by latter defined app