bash 如何在已部署的 Heroku 应用程序上查看文件和文件结构
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38924458/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to see files and file structure on a deployed Heroku app
提问by andy mccullough
My client app that is deployed on Heroku allows the user to upload images onto Heroku. I wanted to test out a change I made to delete images, so I need a way to see the state of the folder structure on Heroku to ensure the images are being deleted successfully of the file system.
我部署在 Heroku 上的客户端应用程序允许用户将图像上传到 Heroku。我想测试我为删除图像所做的更改,因此我需要一种方法来查看 Heroku 上文件夹结构的状态,以确保已成功删除文件系统中的图像。
I tried -
我试过 -
$ heroku run bash --app <appName>
~$ pwd
~$ cd <path to images folder>
but I only see images here that I uploaded along with the app, not what was uploaded through the client app.
但我在这里只看到与应用程序一起上传的图像,而不是通过客户端应用程序上传的图像。
What am I doing wrong?
我究竟做错了什么?
回答by Juliano Araújo
I can do with this commands
我可以用这个命令
heroku login
heroku run bash -a APPNAME
$ cd app
APPNAME
is the name of your Heroku application And in the folder app
are your files.
APPNAME
是您的 Heroku 应用程序的名称,文件夹中app
是您的文件。
When you finish your commands and want to return to your terminal you can write
当你完成你的命令并想回到你的终端时,你可以写
$ exit
回答by DJR-MiqroMeq
Terminal access is now provided by clicking a link "More" on the top right of the Heroku dashboard where you can select "run console". This presents an option to run terminal commands and shows a default of 'bash'. However, you do have to explicitly enter 'bash' or other command. If you edit files, you will have to manage synchronization back to your development code using Git.
现在可以通过单击 Heroku 仪表板右上角的“更多”链接来提供终端访问,您可以在其中选择“运行控制台”。这提供了一个运行终端命令的选项,并显示了默认的“bash”。但是,您必须明确输入“bash”或其他命令。如果您编辑文件,则必须使用 Git 管理与开发代码的同步。
回答by sam
As in @Juliano Araújo's answerbut from a project folder connected via git you can just run
heroku run bash
正如@Juliano Araújo 的回答一样,但是从通过 git 连接的项目文件夹中,您可以运行
heroku run bash