如何访问Heroku上的文件? [英] How to Access files on Heroku?

查看:104
本文介绍了如何访问Heroku上的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于Heroku的项目。这个项目允许我更新一个json文件。如果通过项目的Web界面更新heroku上的内容。我看到更新。我可以关闭浏览器,打开它并更新。

现在,我想推动一些项目。如果我做了json文件将被覆盖。所以,我首先从heroku获取当前项目状态。 heroku提示说一切都是最新的,这是不正确的。我改变了json文件。

使用 heroku运行ls static / json / 显示文件,我需要在推送到heroku之前获取此文件避免破坏网络更新。

解决方案

我不认为这是可能的,因为一个原因:Heroku dyno拥有自己的临时文件系统,并使用最新代码的git签出。然而,它不能以其他方式绕过,不可能将dyno中的文件更改检入到git仓库中。这就是为什么当你尝试拉时,你会得到响应'已经是最新的',因为heroku git remote与你当地的repo是同步的。

你应该可能将您的文件存储在亚马逊的S3或数据库中,或者将数据写入数据库,以便在heroku部署之间持续存在。


I have a project on Heroku. This project allows me to update a json file. If update something on heroku via the project's web interface. I see the update. I can close the browers, open it and the update presists.

Now, I want to push something to project. If I do the json file will be overwritten. So, I pulled first to get current project state from heroku. heroku prompts says everything up to date, which is not true. I changed the json file.

Using heroku run ls static/json/ shows file, I need to get this file before pushing to heroku to avoid destorying web updates.

解决方案

I don't think this is possible, for one reason: A Heroku dyno has it's own ephemeral filesystem with a git checkout of the most recent code. It cannot go the other way around however, it's not possible to check file changes in the dyno in into the git repo. This is why you get the response 'Already up-to-date.' when trying to pull, because the heroku git remote is inn sync with your local repo.

You should maybe store your file on Amazon's S3 or in a database or even write your data to a database, so that it is persisted between heroku deployments.

这篇关于如何访问Heroku上的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆