使用 Cherrypy 从 Heroku 上的 /tmp 服务
Serve from /tmp on Heroku with Cherrypy
我的站点在创建 dyno 后将新的 .html
文件写入 /tmp
。
由于 Heroku 的结构,cherrypy
应用程序在 /app
中。
这会阻止我路由使用 Cherrypy 创建的 .html
文件。知道如何做到这一点吗?
Heroku 的 filesystem is ephemeral:
Each dyno gets its own ephemeral filesystem, with a fresh copy of the most recently deployed code. During the dyno’s lifetime its running processes can use the filesystem as a temporary scratchpad, but no files that are written are visible to processes in any other dyno and any files written will be discarded the moment the dyno is stopped or restarted. For example, this occurs any time a dyno is replaced due to application deployment and approximately once a day as part of normal dyno management.
它不适合永久存储,您写入磁盘的任何内容都可能随时消失。
如果您需要持久地写出数据,您可以use something like Amazon S3或将其存储在数据库中。
Will it be possible to serve the code directly from db then? Assuming that i write the code into db?
是的。
Heroku 本身 provides a PostgreSQL service and many others are available from the addons marketplace.
我的站点在创建 dyno 后将新的 .html
文件写入 /tmp
。
由于 Heroku 的结构,cherrypy
应用程序在 /app
中。
这会阻止我路由使用 Cherrypy 创建的 .html
文件。知道如何做到这一点吗?
Heroku 的 filesystem is ephemeral:
Each dyno gets its own ephemeral filesystem, with a fresh copy of the most recently deployed code. During the dyno’s lifetime its running processes can use the filesystem as a temporary scratchpad, but no files that are written are visible to processes in any other dyno and any files written will be discarded the moment the dyno is stopped or restarted. For example, this occurs any time a dyno is replaced due to application deployment and approximately once a day as part of normal dyno management.
它不适合永久存储,您写入磁盘的任何内容都可能随时消失。
如果您需要持久地写出数据,您可以use something like Amazon S3或将其存储在数据库中。
Will it be possible to serve the code directly from db then? Assuming that i write the code into db?
是的。
Heroku 本身 provides a PostgreSQL service and many others are available from the addons marketplace.