简体   繁体   English

symfony 2.3 app.php似乎没有使用与app_dev.php相同的树枝

[英]symfony 2.3 app.php seems not using the same twig as app_dev.php

I'm facing a strange problem with symfony 2.3 我在使用symfony 2.3时遇到一个奇怪的问题

If I load pages using app_dev.php I can see my custom twig, but if I use app.php it seems to use an empty twig 如果我使用app_dev.php加载页面,则可以看到我的自定义树枝,但是如果我使用app.php,则似乎使用了一个空树枝

please take a look at 请看看

http://www.waltervalvoenterprise.com/app_dev.php/login http://www.waltervalvoenterprise.com/app_dev.php/login

and

http://www.waltervalvoenterprise.com/app.php/login http://www.waltervalvoenterprise.com/app.php/login

As you can see in source code, with app.php it doesn't load bootstrap etc so I think that it uses another twig... 正如您在源代码中看到的那样,使用app.php不会加载bootstrap等,因此我认为它使用了另一个树枝。

Have you ever seen something like this? 你见过这样的东西吗? do you know how to solve this issue? 你知道如何解决这个问题吗?

Perhaps try this commands and see if something changes. 也许尝试此命令,看看是否有变化。

php app/console cache:clear --env=prod --no-debug
php app/console assets:install --env=prod --no-debug
php app/console assetic:dump --env=prod --no-debug
php app/console cache:warmup --env=prod --no-debug

Because you have a login area I guess you configured your security.yml ? 因为您具有登录区域,所以我猜您已配置了security.yml吗? If so don't secure your assets behind a firewall. 如果是这样,请不要在防火墙后面保护您的资产。 Otherwise they don't load. 否则,它们将无法加载。 Could be that the dev assets are cached so you haven't noticed it yet. 可能是因为dev资源已被缓存,所以您还没有注意到它。 But that's only a suggestion... 但这只是一个建议...

In your firewalls section try the following: 在“防火墙”部分中,尝试以下操作:

firewalls:
    dev:
        pattern:    ^/(_profiler|_wdt|images|css|js)
        security:   false

Nothing with Twig here. Twig在这里什么都没有。 You are using assets and in production environment you need to dump it first. 您正在使用资产,在生产环境中,您需要先将其转储。 Read more about dumping assetic files . 阅读有关转储资产文件的更多信息。

php app/console assetic:dump --env=prod --no-debug

Check your page with google chrome console and you will see the errors 使用Google Chrome控制台检查您的页面,您将看到错误

GET http://www.waltervalvoenterprise.com/js/5a7d0d0.js 404 (Not Found) login:41
GET http://www.waltervalvoenterprise.com/css/4e1390a.css 404 (Not Found) login:8

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM