不能在谷歌云应用程序中包含js和css文件

时间:2015-08-12 10:28:17

标签: angularjs .htaccess google-app-engine cloud google-cloud-storage

我正在使用Cloud sql进行灯泡部署。将我的项目上传到xxx.appspot.com后。所有的css和js文件都没有打开。它抛出:

  

错误:未找到请求的URL /public/js/admin/custom.js不是   在这台服务器上找到。

我正在添加css文件,如下所示:

<link rel="stylesheet" href="http://syncspot-ds.appspot.com/public/css/admin/login.css">
<link rel="stylesheet" href="http://syncspot-ds.appspot.com/public/css/admin/bootstrap.css">
<link rel="stylesheet" href="http://syncspot-ds.appspot.com/public/css/admin/font-awesome.css">

我的app.yaml文件如下:

application: xxx
version: 1
runtime: php55
api_version: 1
threadsafe: true

handlers:

- url: /public/css/admin
  static_dir: /public/css/admin

- url: /public/css/front
  static_dir: /public/css/front

- url: /public/css/front/images
  static_dir: /public/css/front/images

- url: /public/fonts
  static_dir: /public/fonts

- url: /public/images
  static_dir: /public/images

- url: /public/images/00-ICON LOGO
  static_dir: /public/images/00-ICON LOGO

- url: /public/images/admin
  static_dir: /public/images/admin

- url: /public/images/background
  static_dir: /public/images/background

- url: /public/images/icons
  static_dir: /public/images/icons

- url: /public/images/logo
  static_dir: /public/images/logo

- url: /public/js/admin
  static_dir: /public/js/admin

- url: /public/js/front
  static_dir: /public/js/front

- url: /public/js/gmap
  static_dir: /public/js/gmap

- url: /public/swf
  static_dir: /public/swf

- url: /public/uploads/channel_content
  static_dir: /public/uploads/channel_content

- url: /public/uploads/profile_img
  static_dir: /public/uploads/profile_img 

- url: /.*
  script: index.php

我的.htaccess文件如下:

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|public|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

我正在使用Code Igniter,AngularJS和MySql。如果我使用外部css说:

 <link rel="stylesheet" href="http://1223.123.123.123/xxx/public/css/admin/login.css">

工作正常。

请帮助我,以便我可以链接到css或js文件。

1 个答案:

答案 0 :(得分:0)

对于静态目录,documentation在static_dir部分中没有前导“/”。

尝试使用以下格式:

- url: /public/css/admin
  static_dir: public/css/admin