0

I have developed two projects:

  1. A package (projA) with Sphinx documentation
  2. A Flask app (projB), which utilizes projA and lists it in the requirements.txt file.

Therefore, projA would be installed in the virtual environment that coincides with projB.

My question is:
How can I safely serve the documentation from the static files in the /docs/build/html directory of projA via a route (let's says /docs) in projA?

Since projA is installed as a dependency, it would be located in the /venv/Lib/.. folder. So, I could proxy /docs to point to the project folder inside the virtual environment folder, but is that safe? Or is there a better way to accomplish this?

barryhunter
  • 20,886
  • 3
  • 30
  • 43
CaffeinatedMike
  • 1,537
  • 2
  • 25
  • 57
  • 1
    I wouldn't serve the docs with flask. I'd use a webserver like nginx or apache to serve the static content. – Michael Ruth Sep 04 '21 at 18:05
  • What if I don't have control over the webserver itself? – CaffeinatedMike Sep 04 '21 at 23:47
  • Does this answer your question? [How to serve static files in Flask](https://stackoverflow.com/questions/20646822/how-to-serve-static-files-in-flask) – Michael Ruth Sep 05 '21 at 00:24
  • All the suggestions are under the assumption that all static files come from whichever static path is provided during app instantiation. In this case, I have static files that are served from the app's static folder, but **also** have the docs that lie within pkgA inside the venv folder. Since the venv folder is at the root directory of the application, 1) would `send_static_file` work still? 2) would the css and js functionality remain intact for the docs? – CaffeinatedMike Sep 05 '21 at 02:03
  • Maybe something like this? `blueprint = Blueprint('docs', __name__, static_url_path='/docs', static_folder='.../venv/Lib/pkgA/docs/build/html')` – CaffeinatedMike Sep 05 '21 at 02:09

0 Answers0