Sphinx documentation inside a Flask running web application

后端 未结 4 1786
隐瞒了意图╮
隐瞒了意图╮ 2021-02-13 04:40

I\'ve locally built static Sphinx documentations (using make html).

I wish now to integrate the Sphinx files into my webapp that runs with Flask. From the

4条回答
  •  爱一瞬间的悲伤
    2021-02-13 05:05

    You can copy the _build/html folder from your docs to a doc folder in your flask static directory, and serve them with the following rule:

    @app.route('/doc//', defaults={'static': True})
    def doc(dir='',filename='index.html'):
        path = join(dir,filename)
        return app.send_static_file(path)
    

提交回复
热议问题