简体   繁体   English

Heroku:RAILS_ROOT返回app文件夹而不是根文件夹

[英]Heroku: RAILS_ROOT returns app folder instead of root folder

I have this RoR app that calls to RAILS_ROOT. 我有这个调用RAILS_ROOT的RoR应用程序。 When running it using rails server (or when checking with ./script/console ) the value contains the app's root. 使用rails服务器运行它时(或使用./script/console检查时),该值包含应用程序的根目录。 When deploying and running it with Heroku, however (or when checking with heroku console ), the returned path is '/app'. 但是,当使用Heroku部署和运行它时(或者使用heroku console检查时),返回的路径为'/ app'。

Why's that? 为什么?

Thanks 谢谢

Because on heroku your app is in the /app folder (from the root / ). 因为在heroku上你的应用程序位于/app文件夹中(来自root / )。 It is NOT the app folder of your application, which is /app/app . 它不是您的应用程序的app文件夹,即/app/app

The file structure is: 文件结构是:

/app/app/...
/app/config/..
/app/Gemfile
...

You can make an experiment. 你可以做一个实验。

Run heroku console and discover the file structure. 运行heroku控制台并发现文件结构。

> heroku console
> puts `ls`
> puts `pwd`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM