What to write or search on github to get the code for what is written below:

Chris Angelico rosuav at gmail.com
Mon Jan 17 17:07:27 EST 2022


On Tue, Jan 18, 2022 at 7:44 AM Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> Heroku-Specific note: a recent web-page I encountered searching for
> information for a different question indicates that Heroku does not support
> SQLite3 and, by extension, ANY file-based dynamic data storage (so, no
> Excel files either). An Heroku Python "dyno" [virtualized work container]
> is initialized using a requirements file -- that file basically lists all
> the 3rd party Python modules that need to be installed using "pip". If the
> "dyno" is stopped (application shut down to upload modifications, or maybe
> just to remove an application that has been idle for some hours) it, and
> any data files, are just deleted -- when someone tries to connect to the
> app again, a new "dyno" is spun up and loaded from scratch. One is supposed
> to use one of the client server databases provided by Heroku for persist
> ant storage (since those are not inside "dyno" container -- the app makes a
> network connection to the database server.

This is correct. I've used Heroku for a number of projects, since it's
easy to deploy there and can be done for zero dollars. If you know how
to use PostgreSQL from Python, it's almost trivially easy to deploy
that to Heroku (just need to arrange your credentials, nothing more).
In contrast, manipulating external files is tricky; in fact, if you
want to do something simple like "upload an image to use as your
avatar", it's probably easier to store that in Postrges than on the
file system.

Part of the reason for the "wipe everything on shutdown" policy is
that it makes Heroku apps extremely easy to scale. You want one
process? Done. Want two dynos so you can serve more clients at once?
Easy. But for that to work, you have to make absolutely sure that
everything is stored externally to the dyno itself.

Like everything else, it requires discipline, a set of rules that you
follow. (And it's a lot easier than some - for instance, the
discipline required for a live-code-update system is a lot harder.)
But while it isn't particularly difficult, it does require some
comprehension. Some time investment. Some actual effort. And that's
what the OP might be running into difficulties.

(For what it's worth, we used Heroku at my last teaching job; it's a
great way to ensure that every student is able to deploy projects, and
since it doesn't cost anything to have a bunch of projects up there,
it doesn't hurt to deploy apps that don't have any "real-world use".
Originally we taught them to use MongoDB, which requires external
hosting, but switched that out for PostgreSQL, which is ever so much
better to work with.)

ChrisA


More information about the Python-list mailing list