Magento:无法加载静态资源 - 当语言不是默认语言时 (en_US)
Magento: Failed to load static resource - When language is not default (en_US)
在本地主机上安装 Magento 之后
正在关注 this instructions
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
此 magento 设置为使用 pt_BR
作为语言,运行 'sudo php bin/magento setup:static-content:deploy' 将静态资源部署为默认语言 (en_US)
该工具需要一个额外的参数来指定它
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: 1494363897
在本地主机上安装 Magento 之后
正在关注 this instructions
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
此 magento 设置为使用 pt_BR
作为语言,运行 'sudo php bin/magento setup:static-content:deploy' 将静态资源部署为默认语言 (en_US)
该工具需要一个额外的参数来指定它
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: 1494363897