S
S
Sergey Beloventsev2016-05-22 23:41:29
Yii
Sergey Beloventsev, 2016-05-22 23:41:29

How to connect dubug on advanced template?

I'm trying to connect the debug panel on the advanced template, browsing the Internet did not give anything except this one

if (YII_ENV_DEV) {
        // configuration adjustments for 'dev' environment
        $config['bootstrap'][] = 'debug';
        $config['modules']['debug']['class'] = 'yii\debug\Module';
        $config['modules']['debug']['allowedIPs'] = ['*'];
    
        $config['bootstrap'][] = 'gii';
        $config['modules']['gii']['class'] = 'yii\gii\Module';
        $config['modules']['gii']['allowedIPs'] = ['*'];
    }

for basic and this one
if (!YII_ENV_TEST) {
        // configuration adjustments for 'dev' environment
        $config['bootstrap'][] = 'debug';
        $config['modules']['debug'] = [
            'class' => 'yii\debug\Module',
        ];
        $config['modules']['debug']['allowedIPs'] = ['*'];
    
        $config['bootstrap'][] = 'gii';
        $config['modules']['gii'] = [
            'class' => 'yii\gii\Module',
        ];
        $config['modules']['gii']['allowedIPs'] = ['*'];
    
    }

but I didn’t understand where to connect if just a white screen appears in config/main/php. Can you tell me how to connect debug and gii if the site is hosted on the server.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Arutyunov, 2016-05-23
@Sergalas

When deploying advanced applications, you performed php init, where you chose the environment - dev or prod.
Debug and gii only work in the dev environment.
Open frontend/config/main.php and go to the very bottom of the file:

$config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
    ];
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
    ];

And in index.php you can specify the dev environment if prod is specified.
As long as you're learning, you can do it. But in real projects this is not necessary .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question