Open bh opened 10 years ago
It works for me™
I had to change jquery
to components/jquery
due to https://github.com/bower/bower/issues/859 but that has nothing to do with Django 1.7. Setting PROJECT_ROOT isn't necessary as BASE_DIR is already set to the same value:
INSTALLED_APP = (
...
'djangobower',
...
)
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
'djangobower.finders.BowerFinder',
)
BOWER_COMPONENTS_ROOT = os.path.abspath(os.path.join(BASE_DIR, 'components'))
BOWER_INSTALLED_APPS = (
'components/jquery',
)
Totally borked under 1.7 for me.
Ended up pulling it out entirely. I tweaked heroku-buildpack-bower so I could run with '--allow-root' (https://github.com/darkpixel/heroku-buildpack-bower) under dokku, then tweaked a few settings like so:
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'static'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(PROJECT_PATH, 'static'),
os.path.join(PROJECT_PATH, '../bower_components')
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
It doesn't™ work for me on 1.7. It's a mystery.
I had a pathing issue too. I pointed my staticfiles_dirs. It seems the version do django-bower installed all the folders under 'components/static/vendor/bower/' Was confusing but the following worked for me based on my folder layout under the components
STATICFILES_DIRS = ( os.path.join(BASE_DIR, "components/static/vendor/bower/"), <-- the root where packages are installed by bower. )
Using BOWER_COMPONENTS_ROOT = os.path.abspath(os.path.join(BASE_DIR, 'components')) works for me. It seams to need the os.path.abspath method call to find the components correctly.
Hi,
Django bower does not work with Django 1.7 without my workaround:
So the static files will be found. But
djangobower.finders.BowerFinder
finds the files, when I try to create an object ofBowerFinder
in a Django shell.