Coder Social home page Coder Social logo

Comments (7)

DAAworld avatar DAAworld commented on June 25, 2024

我还配置了app.config["APPLICATION_ROOT"] = "/eng/",其他接口都可以使用,只有/docs接口没有办法用

from flask-siwadoc.

DAAworld avatar DAAworld commented on June 25, 2024

经过测试,问题出现在 这行return render_template(ui_file, spec_url=self.openapi_url),改成return render_template(ui_file, spec_url=“eng" + self.openapi_url)这样就是可以的
@siwa_bp.route(self.doc_url)
def doc_html():
siwa_user = self.app.config.get("SIWA_USER")
siwa_pass = self.app.config.get("SIWA_PASSWORD")
if siwa_user and siwa_pass:
global users
users = {
siwa_user: generate_password_hash(siwa_pass),
}
login_info = auth.get_auth()
password = auth.get_auth_password(login_info)
status = None
user = auth.authenticate(login_info, password)
if user in (False, None):
status = 401
elif not auth.authorize(None, user, auth):
status = 403
if status:
try:
return auth.auth_error_callback(status)
except TypeError:
return auth.auth_error_callback()
ui = request.args.get("ui") or self.ui
assert ui in SUPPORTED_UI, f"ui only support with {SUPPORTED_UI}"
ui_file = f'{ui}.html'
return render_template(ui_file, spec_url=self.openapi_url)

from flask-siwadoc.

lzjun567 avatar lzjun567 commented on June 25, 2024

这个 /eng 是你的业务路径吧,不能把业务代码侵入到框架代码中去

from flask-siwadoc.

DAAworld avatar DAAworld commented on June 25, 2024

这个 /eng 是你的业务路径吧,不能把业务代码侵入到框架代码中去

是的,那是我的业务路径,不知道有什么方法可以配置?

from flask-siwadoc.

verydemo avatar verydemo commented on June 25, 2024

这个 /eng 是你的业务路径吧,不能把业务代码侵入到框架代码中去

应该默认获取同级路由, 不应该自己去配置

from flask-siwadoc.

verydemo avatar verydemo commented on June 25, 2024

@lzjun567 大佬,改一下templates, 从js 那边获取当前页面的url

from flask-siwadoc.

verydemo avatar verydemo commented on June 25, 2024

@lzjun567 大佬,改一下templates, 从js 那边获取当前页面的url

from flask-siwadoc.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.