server.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:django-gateone 作者: jimmy201602 项目源码 文件源码
def send_extra(self):
        """
        Sends any extra JS/CSS files placed in Gate One's 'static/extra'
        directory.  Can be useful if you want to use Gate One's file
        synchronization and caching capabilities in your app.

        .. note::

            You may have to create the 'static/extra' directory before putting
            files in there.
        """
        #extra_path = resource_filename('gateone', 'static/extra')
        extra_path = os.path.join(getsettings('BASE_DIR'), 'static/extra')
        #if not resource_exists('gateone', '/static/extra'):
            #return # Nothing to do
        if not os.path.exists(extra_path):
            return # Nothing to do        
        #for f in resource_listdir('gateone', '/static/extra'):
            #filepath = resource_filename('gateone', '/static/extra/%s' % f)
            #if filepath.endswith('.js'):
                #self.send_js(filepath, force=True)
            #elif filepath.endswith('.css'):
                #self.send_css(filepath, force=True)
        for f in os.listdir(extra_path):
            filepath = os.path.join(extra_path,f)
            if filepath.endswith('.js'):
                self.send_js(filepath, force=True)
            elif filepath.endswith('.css'):
                self.send_css(filepath, force=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号