gpt4 book ai didi

ruby-on-rails - Rails 应用程序无法在本地计算机上的生产环境中运行

转载 作者:行者123 更新时间:2023-12-02 19:33:54 25 4
gpt4 key购买 nike

在开发环境中它工作正常,但是当我在生产环境中运行应用程序时,它显示我们很抱歉,但出了点问题。如果您是应用程序所有者,请检查日志以获取更多信息。

生产日志显示:

I, [2020-04-21T19:25:25.667458 #31504]  INFO -- : [74b45073-2b93-4d6e-8d02-346cf6c72631] Started GET "/" for 127.0.0.1 at 2020-04-21 19:25:25 +0530
I, [2020-04-21T19:25:25.668742 #31504] INFO -- : [74b45073-2b93-4d6e-8d02-346cf6c72631] Processing by DashboardController#home as HTML
I, [2020-04-21T19:25:25.670973 #31504] INFO -- : [74b45073-2b93-4d6e-8d02-346cf6c72631] Rendering dashboard/home.html.haml within layouts/application
I, [2020-04-21T19:25:25.671255 #31504] INFO -- : [74b45073-2b93-4d6e-8d02-346cf6c72631] Rendered dashboard/home.html.haml within layouts/application (Duration: 0.1ms | Allocations: 15)
I, [2020-04-21T19:25:25.672210 #31504] INFO -- : [74b45073-2b93-4d6e-8d02-346cf6c72631] Completed 500 Internal Server Error in 3ms (Allocations: 1237)
F, [2020-04-21T19:25:25.673501 #31504] FATAL -- : [74b45073-2b93-4d6e-8d02-346cf6c72631]
[74b45073-2b93-4d6e-8d02-346cf6c72631] ActionView::Template::Error (Webpacker can't find application in /home/zamir/rails_studio/sunrise/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
"application.js": "/packs/js/application-fafdbfed632f089e407b.js",
"application.js.map": "/packs/js/application-fafdbfed632f089e407b.js.map",
"entrypoints": {
"application": {
"js": [
"/packs/js/application-fafdbfed632f089e407b.js"
],
"js.map": [
"/packs/js/application-fafdbfed632f089e407b.js.map"
]
}
}
}
):
[74b45073-2b93-4d6e-8d02-346cf6c72631] 6: = controller.page_title
[74b45073-2b93-4d6e-8d02-346cf6c72631] 7: = csrf_meta_tags
[74b45073-2b93-4d6e-8d02-346cf6c72631] 8: = csp_meta_tag
[74b45073-2b93-4d6e-8d02-346cf6c72631] 9: = stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
[74b45073-2b93-4d6e-8d02-346cf6c72631] 10: = javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'
[74b45073-2b93-4d6e-8d02-346cf6c72631] 11: %body
[74b45073-2b93-4d6e-8d02-346cf6c72631] 12: .container-fluid
[74b45073-2b93-4d6e-8d02-346cf6c72631]
[74b45073-2b93-4d6e-8d02-346cf6c72631] app/views/layouts/application.html.haml:9
I, [2020-04-21T19:25:25.988388 #31504] INFO -- : [6a573ad4-9775-4565-8f2e-e32395e409cd] Started GET "/favicon.ico" for 127.0.0.1 at 2020-04-21 19:25:25 +0530
F, [2020-04-21T19:25:25.989343 #31504] FATAL -- : [6a573ad4-9775-4565-8f2e-e32395e409cd]
[6a573ad4-9775-4565-8f2e-e32395e409cd] ActionController::RoutingError (No route matches [GET] "/favicon.ico"):

最佳答案

我猜问题出在 production.rb 配置文件中:您应该允许 Puma 提供静态文件。

在生产服务器中,静态文件通常由 Nginx 提供服务,但如果您在本地计算机上运行 Puma,则情况并非如此。

为此,请在您的 production.rb 中将此值设置为 true(或创建一个名为 RAILS_SERVE_STATIC_FILESENV 变量):

config.public_file_server.enabled = true

关于ruby-on-rails - Rails 应用程序无法在本地计算机上的生产环境中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61345328/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com