【问题标题】:Is there a statics finder for django that will find statics in eggs?是否有 django 的统计信息查找器可以在鸡蛋中找到统计信息?
【发布时间】:2011-07-21 16:30:15
【问题描述】:

我知道 django 中没有为此内置 finder(至少在 1.3 中没有),但我想知道在我尝试之前是否有人已经做了一个。

基本上我正在寻找的是一个静态查找器,它将查找作为鸡蛋文件安装的应用程序,该文件仅包含鸡蛋中的静态目录。

我查看了 django.contrib.staticfiles.finders.AppDirectoriesFinder 的代码,不幸的是,在 Django 1.3 版本中,唯一检查的是已安装应用程序位置的子目录,而不是 egg 中的子目录。

更新:由于还没有回复,我将其视为“否”。 :) 如果我有时间,我可能会自己组装一个,但看起来没什么兴趣。我不知道这是否合适,但如果您碰巧对鸡蛋的静态查找器感兴趣,也许只需发表评论。

【问题讨论】:

    标签: python django django-staticfiles


    【解决方案1】:

    这有点骇人听闻,但这让我可以使用 STATICFILES_DIRS 和 FileSystemFinder。

    def inplaceeditform_path():
        import inplaceeditform
        return os.path.abspath(os.path.join(os.path.dirname(inplaceeditform.__file__),'media'))
    
    STATICFILES_DIRS = (
       ('site/inplaceeditform' ,inplaceeditform_path()),
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-12
      • 1970-01-01
      • 2016-02-11
      • 2017-11-21
      • 1970-01-01
      • 1970-01-01
      • 2013-05-09
      • 1970-01-01
      相关资源
      最近更新 更多