2014-02-28 73 views
3

我試圖爲構建靜態OSERROR在/ [錯誤2]沒有這樣的文件或目錄的Django資產

./manage.py assets build --settings=marketplace.settings.dev 

運行命令,我也得到回溯:

Traceback (most recent call last): 
File "./manage.py", line 10, in <module> 
execute_from_command_line(sys.argv) 
File "/home/web/market/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line 
utility.execute() 
File "/home/web/market/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute 
self.fetch_command(subcommand).run_from_argv(self.argv) 
File "/home/web/market/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv 
self.execute(*args, **options.__dict__) 
File "/home/web/market/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute 
output = self.handle(*args, **options) 
File "/home/web/market/local/lib/python2.7/site-packages/django_assets/management/commands/assets.py", line 88, in handle 
impl.run_with_argv(args) 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/script.py", line 547, in run_with_argv 
return self.run_with_ns(ns) 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/script.py", line 537, in run_with_ns 
return cmd.invoke(ns.command, args) 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/script.py", line 371, in invoke 
return function(**args) 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/script.py", line 171, in __call__ 
disable_cache=no_cache) 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/bundle.py", line 563, in build 
disable_cache=disable_cache)) 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/bundle.py", line 498, in _build 
force, disable_cache=disable_cache, extra_filters=extra_filters) 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/bundle.py", line 384, in _merge_and_apply 
filters_to_pass_down, disable_cache=disable_cache) 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/bundle.py", line 453, in _merge_and_apply 
return filtertool.apply(final, selected_filters, 'output') 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/merge.py", line 269, in apply 
return self._wrap_cache(key, func) 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/merge.py", line 216, in _wrap_cache 
content = func().getvalue() 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/merge.py", line 249, in func 
getattr(filter, type)(data, out, **kwargs_final) 
File "/home/web/market/local/lib/python2.7/site-packages/webassets/filter/coffeescript.py", line 45, in output 
stderr=subprocess.PIPE) 
File "/usr/lib/python2.7/subprocess.py", line 709, in __init__ 
errread, errwrite) 
File "/usr/lib/python2.7/subprocess.py", line 1326, in _execute_child 
raise child_exception 
OSError: [Errno 2] No such file or directory 

我能得到一些有關如何解決這個問題的建議?

回答

0

正如你所看到的,他無法找到你的市場設置。 OSError: [Errno 2] No such file or directory

是您marketplace.settings.dev位於:

  • /home/web/market/local/lib/python2.7/site-packages/
  • /usr/lib/python2.7/

嘗試移動marketplace目錄並重試。

0

看看你的manage.py文件,並確保這條線指向右方設置文件

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marketplace.settings.dev") 
0

File "/home/web/market/local/lib/python2.7/site-packages/django_assets/management/commands/assets.py", line 88, in handle

,並進一步線指示您的命令居然跑。

所以我認爲沒有什麼不妥marketplace.settings.dev

File "/home/web/market/local/lib/python2.7/site-packages/webassets/filter/coffeescript.py", line 45, in output 
stderr=subprocess.PIPE) 
File "/usr/lib/python2.7/subprocess.py", line 709, in __init__ 
errread, errwrite) 
File "/usr/lib/python2.7/subprocess.py", line 1326, in _execute_child 
raise child_exception 
OSError: [Errno 2] No such file or directory 

表明您asset命令excuting一個子進程和子進程試圖訪問不存在的文件之一。

我想你傳遞給你的asset命令中的子進程的目錄有問題。 (路徑設置不正確)

如果顯示asset命令代碼,我可能會進一步幫助您。

1

的錯誤是在您的第三方應用程序django-assets,它使用另一個第三方Python應用程序webassets,其目的是壓縮和減少網絡資產如Javascript,CSS等

的問題是webassets,其中隱藏了具有錯誤配置的例外,實際原因是找不到執行壓縮所需的二進制文件這裏有錯誤的原因:https://github.com/miracle2k/webassets/issues/400

請確保您有需要正確安裝(二進制)操作系統的依賴,使Django的資產+ webassets執行所需的操作。當第一次嘗試其他應用程序用於django-pipeline等相同目的時,我遇到了類似的問題,如果yuglify或其他未正確安裝的壓縮後端出現問題。

相關問題