Closed seankim658 closed 7 hours ago
From within the container, you may need to edit the html files under template (files shown below).
ls -ltr /usr/local/lib/python3.6/site-packages/flask_restx/templates/
-rw-r--r--. 1 root staff 478 Jul 21 18:54 swagger-ui-libs.html
-rw-r--r--. 1 root staff 950 Jul 21 18:54 swagger-ui-css.html
-rw-r--r--. 1 root staff 4286 Jul 21 18:54 swagger-ui.html
For example, I see "swagger-ui.css" referenced in the file /usr/local/lib/python3.6/site-packages/flask_restx/templates/swagger-ui-css.html
<link media="screen" rel="stylesheet" type="text/css" href="{{ swagger_static('swagger-ui.css') }}" />
Try to edit such lines.
When I try to load swagger page at https://hivelab.tst.biochemistry.gwu.edu/biomarker-partnership/api I get a blank white page. The devtools network tab is as follows:![image](https://github.com/biomarker-ontology/biomarker-datasetviewer/assets/33474168/d90572ba-e413-46ce-9f41-58669af9b48c)
I believe the issue is that flask expects the swaggerui static files from the server root. As shown in the "Request initiator chain" the files are being requested from "https://hivelab.tst.biochemistry.gwu.edu/swaggerui/..." instead of "https://hivelab.tst.biochemistry.gwu.edu/biomarker-partnership/api/swaggerui/...".
If I try to visit the direct url where the static files should be served from I can see them. For example, if I visit "https://hivelab.tst.biochemistry.gwu.edu/biomarker-partnership/api/swaggerui/droid-sans.css" directly in my browser I can see the file:![image](https://github.com/biomarker-ontology/biomarker-datasetviewer/assets/33474168/b9e866e2-199b-4fa6-9370-b09923aadfb5)
To attempt to understand the discrepancy of where the static files are being served from I added the following logging to the glyds module
__init__.py
:app.logger.debug(f'STATIC FOLDER: {app.static_folder}') app.logger.debug(f'STATIC URL PATH: {app.static_url_path}') app.logger.debug(f'APIDOC STATIC URL PATH: {apidoc._static_url_path}') app.logger.debug(f'APIDOC STATIC FOLDER: {apidoc.static_folder}')
The output is:
DEBUG:glyds:STATIC FOLDER: /app/glyds/static DEBUG:glyds:STATIC URL PATH: /static DEBUG:glyds:APIDOC STATIC URL PATH: /swaggerui DEBUG:glyds:APIDOC STATIC FOLDER: /usr/local/lib/python3.6/site-packages/flask_restx/static
When I exec into the docker api container I can see the static files are in the /usr/local/lib/python3.6/site-packages/flask_restx/static folder (automated from flask_restx). I believe the issue is with where flask is attempting to serve the files from but I'm not 100% sure.