Magento 2 模式(mode)设置
Magento模式设置概述
为了提高安全性和易用性, magento 2 提供了一个转换 Magento 2 模式的命令.
查看 magento 2 的所有权和权限在开发模式和生产模式中.
当才开发模式改变成生产模式是清除下列目录的内容:
var/cache
var/di
var/generation
var/view_preprocessed
pub/static
Exceptions:
-
.htaccess
文件未删除 -
pub/static
包含指定静态内容版本的文件,此文件不被删除
命令的用法:
magento deploy:mode:show
类似下列显示的消息:
Current application mode: developer.
更改模式
magento deploy:mode:set {mode} [-s|--skip-compilation]
例子如下.
更改为 production mode(生产模式)
magento deploy:mode:set production
类似下列显示的消息:
Enabled maintenance mode
Requested languages: en_US
=== frontend -> Magento/luma -> en_US ===
... more ...
Successful: 1884 files; errors: 0
---
=== frontend -> Magento/blank -> en_US ===
... more ...
Successful: 1828 files; errors: 0
---
=== adminHTML -> Magento/backend -> en_US ===
... more ...
---
=== Minify templates ===
... more ...
Successful: 897 files modified
---
New version of deployed files: 1440461332
Static content deployment complete Gathering css/styles-m.less sources. Successfully processed LESS and/or SASS files CSS deployment complete Generated classes:
Magento\Sales\Api\Data\CreditmemoCommentInterfacePersistor
Magento\Sales\Api\Data\CreditmemoCommentInterfaceFactory
Magento\Sales\Api\Data\CreditmemoCommentSearchResultInterfaceFactory
Magento\Sales\Api\Data\CreditmemoComment\Repository
Magento\Sales\Api\Data\CreditmemoItemInterfacePersistor
... more ...
Compilation complete
Disabled maintenance mode
Enabled production mode.
相关话题
- 缓存管理
- 索引管理
- 配置和运行cron(定时任务)
- 代码编译
- URN(统一资源名称)高亮显示
- 依赖报告(Dependency reports)
- 翻译和语言包
- 部署静态视图文件
- 运行单元测试
- 转换layout(布局) xml 文件
- 性能测试生成数据