在本地主机上安装Magento之后
跟随本指令
Magento无法加载css、javascript (静态文件)

经过一些研究后,我知道我必须运行php bin/magento setup:static-content:deploy,所以我做了
cd /var/www/html/magento
sudo php bin/magento setup:static-content:deploy该工具部署了大量静态文件。
$:/var/www/html/magento$ sudo php bin/magento setup:static-content:deploy
Requested languages: en_US
Requested areas: frontend, adminhtml
Requested themes: Magento/blank, Magento/luma, Magento/backend
=== frontend -> Magento/blank -> en_US ===
=== frontend -> Magento/luma -> en_US ===
=== adminhtml -> Magento/backend -> en_US ===
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Successful: 2136 files; errors: 0
---
........................................................
Successful: 2061 files; errors: 0
---
............................................................................................................................................................................................................................................
Successful: 2012 files; errors: 0
---
=== Minify templates ===
Successful: 869 files modified
---
New version of deployed files: 1494363632但是加载静态资源仍然失败。
Failed to load resource: the server responded with a status of 404 (Not Found) /magento/pub/static/version1494362497/frontend/Magento/luma/pt_BR/css/print.css 发布于 2017-05-10 16:08:52
这个magento被设置为使用pt_BR作为语言,运行'sudo /magento设置:静态内容:部署‘将静态资源部署到默认语言(en_US)。
该工具需要额外的param来指定以下内容
sudo php bin/magento setup:static-content:deploy pt_BR 产出:
Requested languages: pt_BR
Requested areas: frontend, adminhtml
Requested themes: Magento/blank, Magento/luma, Magento/backend
=== frontend -> Magento/blank -> pt_BR ===
=== frontend -> Magento/luma -> pt_BR ===
=== adminhtml -> Magento/backend -> pt_BR ===
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Successful: 2012 files; errors: 0
---
.......................................................................................................................................................................................................................................................................................................................................................
Successful: 2061 files; errors: 0
---
..................................................................................................................................................................................................................................................
Successful: 2136 files; errors: 0
---
=== Minify templates ===
Successful: 869 files modified
---
New version of deployed files: 1494363897https://stackoverflow.com/questions/43897721
复制相似问题