This section has helped me change my question, but it doesn't seem to be the perfect answer. viewer.py code is not changed. Decision:
step1) I embed the code
<script>var FILE_PATH = {{ file }}</script>
in the template.
step2) the script that will use the variable, you need to change the code ( viewer.js ), from:
var file = 'file' in params ? params.file : DEFAULT_URL
to
var file = FILE_PATH ? FILE_PATH: DEFAULT_URL
It allows viewer.js to no longer be independent.
I hope someone will provide a better solution.
jayzhen Nov 18 '17 at 15:26 2017-11-18 15:26
source share