На нашем сервере запущено приложение Flask (xxxx.edu.au:5000). Однако мы установили прокси up xxxx.edu.au/getseq
, который перенаправляет запрос на xxxx.edu.au:5000
К сожалению, в браузере теперь мы получаем Loading failed for the <script> with source “https://xxxx.edu.au/static/vehicle.js”
.
Это структура приложения фляги:
flask
├── getseq.py
├── static
│ └── vehicle.js
└── templates
└── example.html
Приложение для колб, написанное здесь:
$ cat getseq.py
from flask import Flask, render_template, request
from wtforms import Form, RadioField, TextAreaField
from wtforms.widgets import TextArea
SECRET_KEY = 'development'
app = Flask(__name__)
app.config.from_object(__name__)
...
@app.route("/getseq/<mrna_id>", methods=['post', 'get'])
def get_sequences(mrna_id):
...
return render_template('example.html', form=form)
@app.route("/getseq/health", methods=['get'])
def health():
response = app.response_class(
status=200,
mimetype='text/html'
)
return response
if __name__ == '__main__':
print("starting...")
app.run(host='0.0.0.0',port=5000,debug=True)
Путь vehicle.js
определяется здесь:
$ cat templates/example.html
<script type="text/javascript" src="{{url_for('static', filename='vehicle.js')}}"></script>
...
Как можно изменить url_for
или мне нужно поменять getseq.py
?
Заранее спасибо,