简体   繁体   中英

Google App Engine with Rails, Static Assets not working

I have a working rails app running on Google App Engine.

How ever none of my static files, js/css are working.

Console is showing errors:

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

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

I am precompiling my assets with:

RAILS_ENV=production

I have tried adding handlers in my app.yaml with various directories:

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

I have tried various static_dir but get:

Error: Not Found

The requested URL / was not found on this server.

通过在production.rb中添加此行来解决

config.serve_static_files = true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM