2017-04-01 1 views
0

を見つけていない、djangobower.finders.BowerFinderによってロードされる静的ファイルはジャンゴ・バウワー:BowerFinderによってロードされる静的ファイルが何らかの理由で

設定(サーバ内に見つからない404を取得)をロードされていません。 PY

STATIC_ROOT = "/root/Desktop/django-DefectDojo/static/" 

STATIC_URL = '/static/' 

STATICFILES_DIRS =() 

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder', 
    'django.contrib.staticfiles.finders.AppDirectoriesFinder', 
    'djangobower.finders.BowerFinder', 
) 

BOWER_COMPONENTS_ROOT = '/root/Desktop/django-DefectDojo/components/' 

BOWER_INSTALLED_APPS = (
    'jquery-ui', 
) 

INSTALLED_APPS = (
    'djangobower', 
) 

テンプレート

<script src="{% static "jquery-ui/jquery-ui.min.js" %}"></script> 

プロジェクト構造

-project root 
    -static 
    -components 
     -vendor 
      -assets 
       -bower-components 
        -jquery-ui 
         -jquery-ui.min.js 

私は./manage.py collectstatic

続い./manage.py bower installは今、サーバーを実行する上で、私が見つかりません入手できます。

ただし、STATICFILES_DIRS = ('/root/Desktop/django-DefectDojo/components/vendor/assets/bower_components/',)を作成すると、静的ファイルがロードされます。 しかし、これは、BowerFinderがこれを行うことになっているため、そうではありません。

答えて

0

これは一回限りのインスタンスではないようです。これは、django-bowerfinders.pyがまたはcomponentsのいずれかのディレクトリを、提供されたBOWER_COMPONENTS_ROOT変数(見つかったもの)で見つけることができない場合に発生します。

次のようにbower installは今bower_componentsディレクトリが作成されますので、そうすることができません:

-projectroot 
    -components 
     -vendors 
      -assets 
       -bower_components 
        - 
        - 

に対するとして:これを解決する最も簡単な方法はとは対照的に、BOWER_COMPONENTS_ROOT = os.path.join(PROJECT_ROOT, 'components\vendors\assets')設定することです

-projectroot 
    -components 
     -bower_components 
      - 
      - 

やっているだけBOWER_COMPONENTS_ROOT = os.path.join(PROJECT_ROOT, 'components')

関連記事django-bowerさんのレポ: https://github.com/nvbn/django-bower/issues/20

関連する問題