简体   繁体   中英

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...

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM