我根本无法让它工作。我在这里学习教程:https ://github.com/kjvarga/sitemap_generator/wiki/Generate-Sitemaps-on-read-only-filesystems-like-Heroku
我已经让站点地图在本地工作,但是,现在我已经按照本教程进行操作,我既不能加载服务器,也不能使用站点地图命令而不会出错。
错误:
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:203:in `parse': (C:/Users/Callum/Documents/directory/config/environment_variables.ym
l): found a tab character that violate intendation while scanning a plain scalar at line 5 column 22 (Psych::SyntaxError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:151:in `parse'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:127:in `load'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `block in load_file'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `open'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `load_file'
from C:/Users/Callum/Documents/directory/config/initializers/environment_variables.rb:7:in `block in <class:Application>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:36:in `call'
网站地图.rb
require 'rubygems'
require 'sitemap_generator'
SitemapGenerator::Sitemap.default_host = "http://www.uk-franchise.co.uk"
SitemapGenerator::Sitemap.sitemaps_host = "http://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com/"
SitemapGenerator::Sitemap.public_path = 'tmp/'
SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/'
SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new
SitemapGenerator::Sitemap.create do
add root_path, :lastmod => Time.now, :changefreq => 'weekly', :priority => 1
add posts_path, :lastmod => Time.now, :changefreq => 'weekly', :priority => 1
add events_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_accounting_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_agriculture_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_automotive_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_beverage_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_B2B_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_cafeandcoffee_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_care_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_chemical_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_childrenandbabies_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_cleaning_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_communications_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_computers_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_construction_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_consultancy_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_logistics_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_educationandtraining_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_electrical_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_entertainment_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_enviromental_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_estateagents_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_fashion_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_financial_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_food_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_health_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_hirerental_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_hospitality_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_indoorpropertyservices_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_outdoorpropertyservices_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_internet_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_legal_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_manafacture_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_pets_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_promotional_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_print_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_repairandmaintenance_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_investment1_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_investment2_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_investment3_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_investment4_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
Post.all.each do |post|
add post_path(post), :lastmod => post.updated_at, :changefreq => 'monthly', :priority => 1
end
Listing.all.each do |listing|
add listing_path(listing), :lastmod => listing.updated_at, :changefreq => 'yearly', :priority => 1
end
end
SitemapGenerator::Sitemap.ping_search_engines # Not needed if you use the rake tasks
宝石
gem 'sitemap_generator'
gem 'carrierwave'
gem 'fog'
载波.rb
CarrierWave.configure do |config|
config.cache_dir = "#{Rails.root}/tmp/"
config.storage = :fog
config.permissions = 0666
config.fog_credentials = {
:provider => ENV["FOG_PROVIDER"],
:aws_access_key_id => ENV["AWS_ACCESS_KEY_ID"],
:aws_secret_access_key => ENV["AWS_SECRET_ACCESS_KEY"],
}
config.fog_directory = "ukfranchise"
end
环境变量文件
development:
AWS_ACCESS_KEY_ID: mykey
AWS_SECRET_ACCESS_KEY: mykey
FOG_PROVIDER: AWS
FOG_DIRECTORY: ukfranchise
任何建议将不胜感激,将我的头撞在桌上的自动取款机上。