-2

My site writes new .html files into /tmp after the dyno is created. The cherrypy app is in /app due to the Heroku's structure.

This prevents me from routing the .html files created with Cherrypy. Any idea on how to do this?

Stranger26
  • 658
  • 5
  • 11
  • 1
    Cherrypy is a dynamic server, it doesn't write html files. And Heroku isn't for serving static files either. Why are you doing this? – Daniel Roseman Aug 20 '16 at 08:33
  • I am just using cherrypy to serve temporary static pages. The code are generated from other python worker. – Stranger26 Aug 20 '16 at 08:35
  • Will it be possible to serve the code directly from db then? Assuming that i write the code into db? – Stranger26 Aug 20 '16 at 08:36

1 Answers1

2

Heroku's 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.

It's not meant for permanent storage, and anything you write out to disk can disappear at any moment.

If you need to write data out persistently you can use something like Amazon S3 or store it in a database.

Will it be possible to serve the code directly from db then? Assuming that i write the code into db?

Yes.

Heroku itself provides a PostgreSQL service and many others are available from the addons marketplace.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257