2013-09-02 2 views
7

js 및 css를 압축하기 위해 django-pipeline을 구성했습니다. js는 작동하지만 CSS 파일을 찾을 수 없습니다.장고 파이프 라인에서 정적 CSS 파일을 찾을 수 없습니다.

파일은 findstatic 명령을 사용하여 찾을 수 있습니다. 지금은 하나의 CSS 규칙을 가진 단 하나의 파일로 테스트하고 있습니다.

% ./manage.py collectstatic --traceback               

You have requested to collect static files at the destination 
location as specified in your settings. 

This will overwrite existing files! 
Are you sure you want to do this? 

Type 'yes' to continue, or 'no' to cancel: yes 
Copying '/Users/apoorvparijat/Documents/Work_Related/programming/my_projects/analytics_app/devel/stable/static/css/test.css' 
Traceback (most recent call last): 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/django/core/management/base.py", line 222, in run_from_argv 
self.execute(*args, **options.__dict__) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/django/core/management/base.py", line 255, in execute 
output = self.handle(*args, **options) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/django/core/management/base.py", line 385, in handle 
return self.handle_noargs(**options) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 164, in handle_noargs 
collected = self.collect() 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 120, in collect 
dry_run=self.dry_run) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/pipeline/storage.py", line 28, in post_process 
packager.pack_stylesheets(package) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/pipeline/packager.py", line 94, in pack_stylesheets 
variant=package.variant, **kwargs) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/pipeline/packager.py", line 103, in pack 
paths = self.compile(package.paths, force=True) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/pipeline/packager.py", line 34, in paths 
return [path for path in self.sources 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/pipeline/packager.py", line 26, in sources 
for path in glob(pattern): 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/pipeline/glob.py", line 18, in glob 
return sorted(list(iglob(pathname))) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/pipeline/glob.py", line 29, in iglob 
if default_storage.exists(pathname): 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/pipeline/storage.py", line 89, in exists 
exists = self.finders.find(name) is not None 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", line 239, in find 
result = finder.find(path, all=all) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", line 79, in find 
matched_path = self.find_location(root, path, prefix) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", line 96, in find_location 
path = safe_join(root, path) 
File "/Users/apoorvparijat/.virtualenvs/stable/lib/python2.7/site-packages/django/utils/_os.py", line 77, in safe_join 
'path component (%s)' % (final_path, base_path)) 
ValueError: The joined path (/) is located outside of the base path component (/Users/apoorvparijat/Documents/Work_Related/programming/my_projects/analytics_app/devel/stable/static) 

답변

22

쉼표를 놓치고 - 여기 내 구성

PIPELINE_CSS = { 
    'all_css': { 
     'source_filenames': (
      'css/test.css' 
     ) 
    }, 
    'output_filename': 'css/main.css' 
} 

PIPELINE = True 
PIPELINE_CSS_COMPRESSOR = None 

그리고 오류 메시지입니다. 당신은 단지 하나의 요소와 튜플이있는 경우

'source_filenames': (
    'css/test.css' # add a comma here 
) 

, 당신은 그렇지 않으면 파이썬은 표현하지 튜플을 고려할 것, 마지막에 쉼표를 추가해야합니다.