I have a Django application where users upload a WAV file, the backend does some processing, and then pours out the processed .wav file for download. After deploying to Heroku, I found that I cannot write wav files to the "Heroku ephemeral file system" (locally, I write WAV files to myapp / media).
Consolidating SO is that you must use Amazon S3 to store static files. I'm fine with that. The problem is that the python function I use (and all the others that I looked at) needs a file path to write the file. My code that writes .wav files is:
output_path = "..../some_folder"
output_wav = wave.open (output_path, "w")
output_wav.setparams((nchannels, sampwidth, framerate, nframes, comptype, compname))
output_wav.writeframes(scaled_e)
I researched boto, django-storages and Heroku Directly loading S3 files in Python . However, these solutions assume that you already have a file that it points to (exactly what I cannot create without a path to which I can write).
The tmp folder available for Cedar cedar may work for my purposes (although this is not an ideal solution due to its instability), but I can’t even find on Google how it can be used in a python / Django application ...
Django / Heroku noob gathers here in circles and goes crazy! Any help was greatly appreciated.
source
share