无法访问在本地主机上运行的生产环境Rails应用程序:3000

问题描述 投票:0回答:1

我可以在developemnt中使用以下命令正常运行我的rails应用程序:

[rails s然后去localhost:3000

但是,我需要测试产品并尝试过

rails s -e production,但是,当我进入localhost:3000时,我发现Rails服务器中什么也没有发生。

=> Booting Puma
=> Rails 5.2.3 application starting in production 
=> Run `rails server -h` for more startup options
Set localhost 3000 as the default_url_option ----
Puma starting in single mode...
* Version 3.12.1 (ruby 2.6.3-p62), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: production
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop

为什么我不能访问我的生产导轨应用程序?是否有关于如何在本地计算机上运行生产环境的特定教程?我正在使用Mac OSX High Sierra。

ruby-on-rails ruby ruby-on-rails-5 production-environment
1个回答
0
投票

我不相信Rails会将请求记录到生产环境中的控制台中,就像开发中一样,因此您应该不会看到任何事情发生。

尝试在启动服务器之前运行rake assets:precompile。另外,请确保已为生产环境创建了数据库,并且已迁移。您可以像这样创建数据库:rake db:create RAILS_ENV=production,然后像这样rake db:migrate RAILS_ENV=production

进行迁移

如果仍然无法让您的应用程序在生产环境中运行,请检查生产日志。

© www.soinside.com 2019 - 2024. All rights reserved.