【问题标题】:Google App Engine with Rails, Static Assets not working带有 Rails 的 Google App Engine,静态资产不起作用
【发布时间】:2016-02-29 17:34:59
【问题描述】:

我有一个在 Google App Engine 上运行的可用 rails 应用。

我的静态文件,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.

【问题讨论】:

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


    【解决方案1】:

    通过在production.rb中添加这一行解决

    config.serve_static_files = true
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-12
      • 1970-01-01
      • 2011-02-11
      • 1970-01-01
      • 2010-10-16
      • 1970-01-01
      • 2017-08-15
      相关资源
      最近更新 更多