The Blog

Magento Developer Modes

In Magento 2.0, there’s a command line tool that allows you to switch between modes. This article details some of these modes and also explains how to do it. More information can be found on in the Magento DevDocs (devdocs.magento.com)

Developer Modes

default

According to the documentation, “Enables you to deploy the Magento application on a single server without changing any settings. However, default mode is not optimized for production (even though this is the default setting, it really does run slow). To deploy the Magento application on more than one server or to optimize it for production, change to one of the other modes. In this mode, symlinks to static view files are published to the /pub/static/ directory. Exceptions aren’t displayed to the users, but written to logs. Hides X-Magento-* HTTP request and response headers.

developer

This is only intended for development. Again, symlinks to static view files are published to the /pub/static/ directory. If you look in that directory, there’s a bunch of theme files under a new /en_US/ folder. Performance is really slow.

production

This is intended to be deployed on a production server. No exceptions are displayed to users, only written to logs. Static view files are served up from the /pub/static/ only (maybe the other modes are compiling on each request…which seems to be the case when editing and working with CSS/LESS files).

How To Set The Mode

Setting the mode has to be done via the shell. This section references the Magento DevDocs section on mode changes. Since Magento 2.0 relies more on command line functionality, it’s a good idea to get familiar with the tools.

-- setting the mode; in the load of magento file that 
-- exist, there's a /bin/magento application you can 
-- run to do various tasks; to run code, I normally 
-- go to the /bin/ directory and use the 
-- ./magento {command here} syntax to run things:

-- display current mode
magento deploy:mode:show
Current application mode: developer.

-- set current mode
magento deploy:mode:set {mode} (e.g. production)
-- lists a number of compilation messages

When the mode is changed from developer to production, or vice versa, the contents of the following directories are cleared out:

var/cache
var/di
var/generation
var/view_preprocessed
pub/static

Tags:

No comments yet.

Leave a Comment

Remember to play nicely folks, nobody likes a troll.

You must be logged in to post a comment.