Answer the question
In order to leave comments, you need to log in
Why does url_for duplicate url_prefix for blueprint when running flask via fcgi?
Good afternoon. There is a simple Flask application:
api.py
from flask import Blueprint
from flask import url_for, jsonify
api = Blueprint('api', __name__)
@api.route('/', methods=['GET', 'OPTIONS'])
def index():
links = dict()
links['docs'] = url_for('.docs')
return jsonify(_links=links)
@api.route('/docs/', methods=['GET'])
def docs():
doc = {
" key": "value"
}
return jsonify(doc), 200
from flask import Flask, request
from .api import api
app = Flask(__name__)
app.register_blueprint(api, url_prefix='/api')
from .app import app
if __name__ == '__main__':
app.run(debug=True)
from .app import app
from flup.server.fcgi import WSGIServer
if __name__ == '__main__':
WSGIServer(app, bindAddress='/tmp/fcgi.sock').run()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question