带有Rails的Google App Engine,静态资产无效

时间:2016-02-29 17:34:59

标签: ruby-on-rails google-app-engine

我在Google App Engine上运行了一个有效的应用程序。

我的静态文件js / css是如何工作的。

控制台显示错误:

Failed to load resource: the server responded with a status of 404 (OK)

https://automata-tech.appspot.com/assets/application-20dae9833e60c26566d09f41137460a88163a1fc6a579d0e5db204f6e3a6bc37.css 

我正在预编译我的资产:

RAILS_ENV=production

我尝试在app.yaml中添加处理程序,其中包含各种目录:

runtime: ruby
vm: true
entrypoint: bundle exec unicorn -p 8080 -E production config.ru

resources:
  cpu: .5
  memory_gb: 1.3
  disk_size_gb: 10

automatic_scaling:
  min_num_instances: 1
  max_num_instances: 1
  cool_down_period_sec: 60
  cpu_utilization:
    target_utilization: 0.8

 handlers:
 - url: /assets
 static_dir: /public/assets

我尝试过各种static_dir,但得到:

Error: Not Found

The requested URL / was not found on this server.

1 个答案:

答案 0 :(得分:1)

通过在production.rb

中添加此行来解决
config.serve_static_files = true