Cakephp - 不加载 css 和 js [英] Cakephp - not loading css and js

查看:30
本文介绍了Cakephp - 不加载 css 和 js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名 Rails 开发人员,正在对 cakephp 项目进行一些拼凑.

I'm a rails developer doing some patchwork on a cakephp project.

我从存储库中提取并尝试启动并运行该项目的本地版本.

I pulled from a repository and am trying to get a local version of the project up and running.

现在,应用程序正在尝试从localhost/static/css"加载资产

Right now, the application is trying to load assets from 'localhost/static/css'

css实际上位于localhost/app-name/app/webroot/static/css.

The css is actually located in localhost/app-name/app/webroot/static/css.

我已重命名所有 htaccess 文件(app-name/.htaccess、app/.htaccess、app/webroot/.htaccess)并将它们注释掉,但应用程序仍在localhost/static"中寻找我的资产/'.

I've renamed all the htaccess files (app-name/.htaccess, app/.htaccess, app/webroot/.htaccess) and commented them out, but the app is still looking for my assets at 'localhost/static/'.

我错过了什么?

谢谢

推荐答案

您需要 .htaccess 文件!

您是否安装并启用了 mod_rewrite?

Do you have mod_rewrite installed and enabled?

您是否在 apache 配置中为您的应用程序 webroot 设置了 allow_override All 设置?(因此 apache 将读取 CakePHP .htaccess 文件)

Do you have allow_override All set for your application webroot in you apache config? (So apache will read the CakePHP .htaccess files)

你清除缓存了吗?(删除所有文件,但将目录保留在 app/tmp 中 - 并确保 app/tmp可读/可写网络服务器

Did you clear the cache? (Remove all the files, but leave the directories in place in app/tmp - and make sure app/tmp is readable/writable by the webserver

您是否缺少符号链接?我将我的资产存储在 webroot 之外,并象征性地将目录(css、js、img 等)链接到 /app/webroot

Are you missing a symbolic link? I store my assets outside of webroot and symbolically link the directories (css, js, img, etc.) to /app/webroot

这篇关于Cakephp - 不加载 css 和 js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆