I have generated sphinx documentation for my project into documentation folder. Now I want to serve that using a flask server.
This is my project structure. I want to serve example.html
from the documentation folder. That folder also has relevant CSS files required for it.
app/
module1/
module2/
documentation/
build/
example.html
styles.css
...
templates/
other_files.html
...
app_controller.py
@application.route("/doc", methods=["GET"])
@log_exceptions_to_github
def doc():
return render_template('/build/index.html')
Issue:
Flask looks for HTML files in the "templates" folder only by default.
So I am not able to serve this. Note that copying from documentation dir to templates dir is not what I want to do because of project requirements.
I want to add "documentation" folder as a templates directory along with the default one.
I have tried this but it is not working: https://stackoverflow.com/a/13598839/2286762