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

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

问题描述

我是一个rails开发人员在cakephp项目上做一些拼凑。



我从一个存储库拉取,并试图获得一个本地版本的项目,



现在,应用程序尝试从'localhost / static / css'加载资源

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



我重命名了所有的htaccess文件(app-name / .htaccess ,app / .htaccess,app / webroot / .htaccess)并注释掉它们,但是应用程序仍然在localhost / static /'.



上查找我的资源



感谢

解决方案

code> .htaccess files!



是否安装并启用了mod_rewrite?



您有allow_override为您的应用程序设置所有 webroot 在您 apache config? CakePHP .htaccess 文件)



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



您缺少一个符号链接? $ c> webroot 并以符号方式将目录(css,js,img等)链接到 / app / webroot


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.

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

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

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/'.

What am I missing?

Thanks

解决方案

You need the .htaccess files!

Do you have mod_rewrite installed and enabled?

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

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

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天全站免登陆