2017-09-11 43 views
0

這是回溯的最後幾行:Django的管道FileNotFoundError當我執行manage.py collectstatic

File "C:\PycharmDev\TestVirtualEnv\testEnv1\lib\site-packages\pipeline\compressors\__init__.py", line 247, in execute_command 
    stdin=subprocess.PIPE, stderr=subprocess.PIPE) 
    File "C:\Python34\Lib\subprocess.py", line 859, in __init__ 
    restore_signals, start_new_session) 
    File "C:\Python34\Lib\subprocess.py", line 1112, in _execute_child 
    startupinfo) 
FileNotFoundError: [WinError 2] ... 

而且在settings.py:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 

STATIC_URL = '/static/' 
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' 
STATIC_URL = '/static_prepared/' 
STATIC_ROOT = os.path.join(BASE_DIR, 'static') 
STATICFILES_DIRS = [ 
    os.path.join(BASE_DIR, 'static_prepared'), 
] 
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder', 
    'django.contrib.staticfiles.finders.AppDirectoriesFinder', 
    'pipeline.finders.PipelineFinder', 
) 
PIPELINE = { 
    'STYLESHEETS': { 
     'static_prepared': { 
      'source_filenames': (
       '*.css', 
      ), 
      'output_filename': 'colors.css' 
     }, 
    }, 
    'JAVASCRIPT': { 
     'static_prepared': { 
      'source_filenames': (
       '*.js', 
      ), 
      'output_filename': 'stats.js', 
     } 
    } 
} 

這有什麼錯嗎?

當我使用manage.py collectstatic時,它根本無法與管道一起工作。

它似乎只有沒有管道工程。

與沒有管線相同。正常manage.py collectstatic。

爲什麼發生錯誤?

我已經手動在os.path.join(BASE_DIR,...)上創建了static和static_prepared目錄。

如何正確設置管道?

回答

1

更換其他名稱,如

PIPELINE = { 
    'STYLE': { 
     'static_prepared': { 
      'source_filenames': (
       '*.css', 
      ), 
      'output_filename': 'colors.css' 
     }, 
    }, 
    'JSCRIPT': { 
     'static_prepared': { 
      'source_filenames': (
       '*.js', 
      ), 
      'output_filename': 'stats.js', 
     } 
    } 
} 
相關問題