I write a script to fetch content from other site, and save it to my public/
directory. Due to my network's poor environment, I deployed it to Heroku
and wish it do it instead of me doing it locally.
Just something simple like this
movie_file = "#{Rails.root}/public/movie_list#{year}.json"
File.open(movie_file, "w"){|f| f.write(JSON.pretty_generate($movie_list))}
However, when I run it in heroku(just a rake task
), it seems like it can't write into the public/
directory, I get no such page error
. And I find this answer: Problems with public directory when deploying Node.js app with Heroku
But the original article is unavaible in heroku
, and I'm not sure if its still true.
I'm wondering:
If there is any workaround that I can save it to the server (maybe something other than the public/
), and then I can download it to my computer?
Or, Instead of wrting the file into public/
, maybe I can upload it to other free space?
======================
UPDATE:
Finally, I first save file to tmp
, and then save it to Qiniu
(An China counterpart as AWS
), and you can save it to AWS