Heroku可以编辑文件吗? [英] Can Heroku edit files?

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

问题描述

我在Heroku上部署了一个应用程序,该应用程序从文件中读取一行,然后应该删除该文件中的该行并将该行添加到其他文件中.如果所有必需的文件都在Heroku git存储库中,并且假设代码运行没有任何错误,是否会更改文件?

I have an app deployed on Heroku that reads a line from a file, then is supposed to delete that line in the file and add that line to a different file. If all the necessary files are in the Heroku git repo and assuming the code runs without any errors, will the files be changed?

推荐答案

只要您的dyno重新启动,直接在Heroku dynos上对文件系统所做的更改都将丢失.此经常发生:

Changes made directly to the filesystem on Heroku dynos will be lost whenever your dyno restarts. This happens frequently:

Dynos还每天至少重新启动一次(循环)一次,以帮助维护Heroku上运行的应用程序的运行状况.对本地文件系统的任何更改都将被删除.循环每24小时发生一次(最多可随机分配216分钟,以防止应用程序的每一个dyno同时启动).

Dynos are also restarted (cycled) at least once per day to help maintain the health of applications running on Heroku. Any changes to the local filesystem will be deleted. The cycling happens once every 24 hours (plus up to 216 random minutes, to prevent every dyno for an application from restarting at the same time).

您应该考虑使用数据库,而不是写入文件系统上的文件.Heroku 提供PostgreSQL服务,但是有许多

Instead of writing to a file on the filesystem you should consider using a database. Heroku provides a PostgreSQL service, but there are many other options.

如果出于某些原因您确实需要存储文件,则建议使用Amazon S3之类的Heroku /a>.

If for some reason you really do need to store a file, Heroku recommends using something like Amazon S3.

这篇关于Heroku可以编辑文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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