在我的Rails应用程序上安装了Octopress但是没有呈现GET请求?

时间:2015-12-25 11:59:30

标签: ruby-on-rails ruby ruby-on-rails-4 octopress

我的rails应用程序和Octopress应用程序都可以单独运行,但是当我在我的rails应用程序上安装我的章鱼博客时,get请求永远不会呈现。

       Started GET "/" for 127.0.0.1 at 2015-12-25 06:49:54 -0500
       Processing by HomepageController#index as HTML
       Rendered homepage/index.html within layouts/application (6.4ms)
       Completed 200 OK in 929ms (Views: 892.0ms | ActiveRecord: 0.0ms)




       Started GET "/blog/" for 127.0.0.1 at 2015-12-25 06:50:00 -0500`

rails app GET请求按预期呈现。 我的routes.rb文件正确地将所有请求路由到Blog类,但没有呈现任何内容。

octopress/config.ru

    require 'bundler/setup'
    require 'sinatra/base'

    # The project root directory
    $root = ::File.dirname(__FILE__)

    class Blog < Sinatra::Base

       get(/.+/) do
          send_sinatra_file(request.path) {404}
       end

        not_found do
          send_file(File.join(File.dirname(__FILE__), 'public', '404.html'),         {:status => 404})
        end

        def send_sinatra_file(path, &missing_file_block)
          file_path = File.join(File.dirname(__FILE__), 'public',  path)
          file_path = File.join(file_path, 'index.html') unless file_path =~ /\.[a-z]+$/i
           File.exist?(file_path) ? send_file(file_path) : missing_file_block.call
        end


    end

0 个答案:

没有答案