You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Im writing to a WAV file using Python script and trying to play it using HTML <audio> tag from Static dir...
The Process:
Parameters from website are written to .txt in views --> Python file exc. with subprocess.call and .txt parameters read --> WAV (sound.wav) written to with Python and saved in Static --> WAV referenced using Static ---> WAV played with button.click using HTML <audio>
Problems:
1. HTML is caching the file and not playing updated WAV (b/c same name). How can I create new file names and send to Python script through views?
2. What would be the best way to deliver and play a new WAV file to the Template without static?
Thanks,
Joseph Kerr
ludovic coues
unread,
Jul 11, 2016, 6:48:25 AM7/11/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
My go to solution for that king of problem is to append a query
argument. If the browser have a cached version of sound.wav?v=1 but
you serve sound.wav?v=2, the browser should grab the last version,
even if the file is still named sound.wav.
For your second point, you could use BytesIO, from the io modules in
the standard library. It give you a file like object, you work on it
like you would with a real file then you craft your response with
getvalue and by settings the appropriate headers.