How to set Magento 2 modes (production, development)

- Magento 2

Magento 2 Development

To set a Magento 2 mode, use the following command:

where

{mode} can be developer or production. It is required.

As for –skip-compilation, it is an optional parameter. You can utilize it for skipping code compilation while changing to production mode.

For changing to the production mode, use the below command:

You should get the following summary of messages as a result:

While changing to the developer mode, don’t forget to clear generated classes, as well as Object Manager entities. Thus, you will prevent unexpected errors.

Changing from the production mode requires deleting the contents of the both  var/generation and var/di directories:

To set the mode, use the following comand:

You should get the below messadge:

More tips from Magento 2 Developer’s Cookbook

Source