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.
2016-07-10 23:56 GMT+02:00 Joe Gredder <joekerrg@gmail.com>:
> 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
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/43292bf1-58bd-4508-b941-9872df21d1b0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Cordialement, Coues Ludovic
+336 148 743 42
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEuG%2BTYnjROC5ukgV7PYRE3aJSmA1BFTp-5zA9Mt_fAvqVdopw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment