Reputation: 377
I were fighting with this for for hours, please, help me fix this or kill me =(
I am getting 404 for all 4 files in view. No compiled files anywhere.
Python 3.4.0 in virtualenv, Django 1.7 RC3.
Btw:
python manage.py collectstatic
copies everything from assets to assets_compressed,and adds admin styles there. But there's an error in the end:
ValueError: The joined path (/) is located outside of the base path component (/home/val/Programming/Django/nedviga/nedviga/assets)
Settings:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'pipeline',
)
...
STATIC_URL = '/assets/'
STATIC_ROOT = os.path.join(BASE_DIR, 'assets_compressed')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'assets'),
)
...
PIPELINE_ENABLED = True
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'
PIPELINE_COMPILERS = (
'pipeline.compilers.less.LessCompiler'
)
PIPELINE_CSS = {
'libs': {
'source_filenames': (
'libs/bootstrap/css/bootstrap.min.css'
),
'output_filename': 'css/libs.css'
},
'site': {
'source_filenames': (
'main.less'
),
'output_filename': 'css/main.css'
}
}
PIPELINE_JS = {
'libs': {
'source_filenames': (
'libs/jquery/jquery-2.1.1.min.js'
'libs/bootstrap/js/bootstrap.min.js'
),
'output_filename': 'js/libs.js'
},
'site': {
'source_filenames': (
'main.js'
),
'output_filename': 'js/main.js'
}
}
Dir structure:
project_name
assets
libs
...
main.js
main.less
assets_compressed
*empty*
project_name
manage.py
View:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>AAARGH</title>
{% load compressed %}
{% compressed_css 'libs' %}
{% compressed_css 'site' %}
</head>
<body>
{% compressed_js 'libs' %}
{% compressed_js 'site' %}
</body>
</html>
Upvotes: 4
Views: 2191
Reputation: 353
You need to put comma after each source_filenames. Even if it has only 1 source.
For example:
'source_filenames': (
'main.less' ,
),
not
'source_filenames': (
'main.less'
),
Upvotes: 2
Reputation: 3516
I don't know if it still can be useful but you simply forgot to add 'pipeline.finders.PipelineFinder' to your STATICFILES_FINDERS :
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
)
Upvotes: 0