Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twig : auto_reload option in production recommended?

When auto_reload option is true, it means when a template file is modified, Twig recompiles the file and then render the content.

Question : Is auto_reload option set to true recommended in production environment?

In my opinion, it should be set to true in production because If i am using GIT and one of my twig template file has new changes, and then i update my production codes using 'git pull', i dont have to clear cache anymore, Twig automatically detects that this template file has been changed and need to recompile it. So when the template file is being rendered, it will be rendered with the most recent changes.

Would anyone agree with me? If not, then what would you recommend?

like image 874
Bogs Imba Avatar asked Jan 21 '26 08:01

Bogs Imba


1 Answers

I don't agree with you :) auto_reload should be set to false in production. Moreover, I don't recommend to do a git pull to do a live update of the production code.

I recommend you to set a deployment mechanism which is safer for your code. This can be as easy as a script console or based on tools such as Capistrano or Deployer.

like image 156
Javier Eguiluz Avatar answered Jan 22 '26 20:01

Javier Eguiluz