Sinatra与领班无法正常启动

时间:2019-03-14 14:57:07

标签: ruby sinatra foreman

在解决问题时,我将其简化为最简单的方案。这是我的代码。

# dummyProcfile
web: bundle exec rackup dummyconfig.ru -p $PORT

# dummyconfig.ru
require File.expand_path('dummyapp', File.dirname(__FILE__))

run DummyApp

# dummyapp.rb
require 'sinatra/base'

class DummyApp < Sinatra::Base
  get "/" do
    "hello world"
  end
end

foreman start -f dummyProcfile
10:49:00 web.1  | started with pid 9211
10:49:00 web.1  | Puma starting in single mode...
10:49:00 web.1  | * Version 3.12.0 (ruby 2.6.0-p0), codename: Llamas in Pajamas
10:49:00 web.1  | * Min threads: 0, max threads: 16
10:49:00 web.1  | * Environment: production
10:49:00 web.1  | * Listening on tcp://0.0.0.0:5000
10:49:00 web.1  | Use Ctrl-C to stop

如果我使用浏览器打开http://0.0.0.0:5000,它将在浏览器窗口中打印“找不到文件”。如果我通过机架运行该应用程序,它将按预期运行:

rackup dummyconfig.ru
Puma starting in single mode...
* Version 3.12.0 (ruby 2.6.0-p0), codename: Llamas in Pajamas
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://localhost:9292
Use Ctrl-C to stop

我想念什么?

0 个答案:

没有答案