허민선
허민선

Reputation: 57

create and read a .txt File on heroku with python app

i created Line-bot app using heroku as host, which can create, read, and append into a txt_files on heroku by sending a command from Line account,

so i tried to sent message to my Line-bot with command like this:

username = "user_name"
password = "pass_word"

i sent that text to my Line-bot and it saves my username and password into a txt_file(of course it check if there was no txt_file for save those data it will create txt_file automatically) on heroku, and by another command which can read the text which my Line-bot saved last time, my Line-bot sent me message and it shows:

username is user_name
password is pass_word

however after a few hours when i need my username and password/read back my data, by sending the same command, the data is gone and becomes like this

username is //empty 
password is //empty

what should i do for this problem?

thank you...

Upvotes: 1

Views: 1450

Answers (1)

Chong Tze Zhao
Chong Tze Zhao

Reputation: 11

Are you using a free-level heroku account? If so, heroku does not allow permanent (long-term) file storage. As long as the dyno is shut down, any changes will be reverted.

An alternative is to use an external server as a database, but those may suffer from slower connection.

This article tells you more about heroku.

Upvotes: 1

Related Questions