You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a template flask server for myself Template Git Repo.
When I run the server, and try to access the endpoint /apidocs, the static files aren't being loaded. I managed to get around this for the favicon.ico, by adding following code to my init.py:
But it is still not serving the .js and .css files for swagger ui.
I've tried accessing these endpoints via my browser:
/apispec_1.json
/flasgger_static/swagger-ui.css
/flasgger_static/swagger-ui-bundle.js,
/flasgger_static/swagger-ui-standalone-preset.js, and
/flasgger_static/lib/jquery.min.js
And they do load into my browser (i can see them).
I checked network details in my browser, and there is no .js or .css files being loaded.
I'm not getting any server log errors, and not getting any errors in my web browsers console.
If i've missed anything more helpful info, let me know.
I'm just running flask server so no reverse proxy at the moment (if anyone has similar issue and is running a reverse proxy, here is the info for that: Reverse Proxy Info.
I've also tried to externally load swaggerui with this: Externally load swagger UI. This didn't load anything either.
Turns out in my middleware/response_manipulator.py file my response_manipulator function was the issue.
The response_manipulator function is designed to modify Flask responses before they are sent to the client. Specifically, it adds metadata, sets the Content-Type header to application/json, and adds a custom header. However, this function made an assumption that every response should be JSON, which might not be suitable for all responses, especially for those serving HTML content like the Swagger UI.
Hi!
I have created a template flask server for myself Template Git Repo.
When I run the server, and try to access the endpoint /apidocs, the static files aren't being loaded. I managed to get around this for the favicon.ico, by adding following code to my init.py:
@server.route('/favicon.ico') def favicon(): return server.send_static_file('favicon.ico')
But it is still not serving the .js and .css files for swagger ui.
I've tried accessing these endpoints via my browser:
/apispec_1.json
/flasgger_static/swagger-ui.css
/flasgger_static/swagger-ui-bundle.js,
/flasgger_static/swagger-ui-standalone-preset.js, and
/flasgger_static/lib/jquery.min.js
And they do load into my browser (i can see them).
I checked network details in my browser, and there is no .js or .css files being loaded.
I'm not getting any server log errors, and not getting any errors in my web browsers console.
If i've missed anything more helpful info, let me know.
I'm just running flask server so no reverse proxy at the moment (if anyone has similar issue and is running a reverse proxy, here is the info for that: Reverse Proxy Info.
I've also tried to externally load swaggerui with this: Externally load swagger UI. This didn't load anything either.
I did find a similar issue 426
Thank you in advance!
The text was updated successfully, but these errors were encountered: