jas*_*328 4 sitemap rake ruby-on-rails heroku
我正在为我的网站生成站点地图,并暂时将其保存到tmp文件夹,然后上传到我的Amazon AWS账户.我正在使用站点地图生成器和雾宝石来帮助我.到目前为止我有这个......
# In sitemap.rb
# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = "http://mycoolapp.com/"
# pick a place safe to write the files
#SitemapGenerator::Sitemap.public_path = 'tmp/'
# store on S3 using Fog
SitemapGenerator::Sitemap.adapter = SitemapGenerator::S3Adapter.new
# inform the map cross-linking where to find the other maps
SitemapGenerator::Sitemap.sitemaps_host = "http://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com/"
# pick a namespace within your bucket to organize your maps
SitemapGenerator::Sitemap.sitemaps_path = '/'
SitemapGenerator::Sitemap.create do
# Put links creation logic here.
#
add '/home'
add '/about'
add '/contact'
end
Run Code Online (Sandbox Code Playgroud)
每当我跑,heroku run rake sitemap:create我收到以下错误...
In '/app/tmp/':
511
rake aborted!
Read-only file system - /sitemap.xml.gz
Run Code Online (Sandbox Code Playgroud)
我真的不知道为什么它不起作用.我甚至通过Rails.root.join('tmp')作为初始化程序运行来确保创建tmp文件夹.任何帮助解决这个问题将不胜感激.
Rake非常清楚错误的来源:
耙子流产了!
只读文件系统 - /sitemap.xml.gz
这告诉您rake任务正在尝试将文件写入文件系统的根目录.
如果您没有使用像Celadon Cedar这样的短暂文件系统支持的堆栈,则需要确保您正在写入而不是文件系统的根目录.我没有这个测试自己,但你可以简单地通过指向解决此问题的一个可写目录.例如:#{RAILS_ROOT}/tmpsitemaps_path
SitemapGenerator::Sitemap.sitemaps_path = '/app/tmp'
Run Code Online (Sandbox Code Playgroud)
如果这不起作用,则必须跟踪gem或rake任务将根目录定义为写入sitemap.xml.gz文件的位置.
| 归档时间: |
|
| 查看次数: |
866 次 |
| 最近记录: |