I have installed Symphony2 framework and created my own bundle. I am using assetic for my js and css files.
I am running ubuntu on my server and mint on my local machine.
When I access the app_dev.php locally all assets serve just fine.
When I access the app.php locally all assets serve just fine.
However on my server, the route gets rendered but the assets (css & js) i get a 404.
When i tail the prod.log i get an uncaught Exception below:
PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /admin/css/875a243.css""
I have searched the web high and low and i cannot seem to figure this out.
I have cleared caches, assetic dumped, assets install , all permissions are correct.
my app routing.yml config:
brs:
resource: "@BrsAdminBundle/Resources/config/routing.yml"
prefix: /
my bundle routing.yml config
admin:
path: /admin/
defaults: { _controller: BrsAdminBundle:Admin:index }
my app config:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: assets.yml }
framework:
#esi: ~
#translator: { fallback: "%locale%" }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_proxies: ~
session: ~
fragments: ~
http_method_override: true
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: "%kernel.root_dir%/Resources/java/compiler.jar"
#yui_css:
# jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
my asset.yml config:
assetic:
assets:
bootstrap_js:
inputs:
- '%Kernel.root_dir%/Resources/public/js/jquery-2.1.3.min.js'
- '%Kernel.root_dir%/Resources/public/js/bootstrap.min.js'
bootstrap_css:
inputs:
- '%Kernel.root_dir%/Resources/public/css/bootstrap.min.css'
- '%Kernel.root_dir%/Resources/public/css/bootstrap-theme.min.css'
admin_css:
inputs:
- '@BrsAdminBundle/Resources/public/css/styles.css'
my base.html.twig that uses assetic:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{% block title %}BankRoll Supply{% endblock %}</title>
{% block stylesheets %}
{% stylesheets '@bootstrap_css' '@admin_css' %}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}
{% javascripts '@bootstrap_js' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
</body>
</html>
Any help would be greatly appreciated.
Thank you,
Ad
--end=prod
was enough for me. (assets:install --end=prod
) Without it it takes ~5 minutes and doesn't work afterwards (no errors). With that added it took a second or 2 and worked! – Pollock