{"id":5936,"library":"flask-swagger-ui","title":"Flask-Swagger-UI","description":"Flask-Swagger-UI is a Python library that provides a simple Flask blueprint to integrate Swagger UI into your Flask applications. It currently bundles Swagger UI version 5.32.1. While the project is not actively maintained, it receives occasional updates to keep the bundled Swagger UI version current. Users requiring more active development or specific new features might consider forking the repository.","status":"maintenance","version":"5.32.2","language":"python","source_language":"en","source_url":"https://github.com/sveint/flask-swagger-ui","tags":["Flask","Swagger","API","Documentation","UI"],"install":[{"cmd":"pip install flask-swagger-ui","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for Flask blueprint integration.","package":"Flask","optional":false}],"imports":[{"symbol":"get_swaggerui_blueprint","correct":"from flask_swagger_ui import get_swaggerui_blueprint"}],"quickstart":{"code":"from flask import Flask\nfrom flask_swagger_ui import get_swaggerui_blueprint\n\napp = Flask(__name__)\n\nSWAGGER_URL = '/api/docs'  # URL for exposing Swagger UI (without trailing '/')\nAPI_URL = 'https://petstore.swagger.io/v2/swagger.json'  # Our API url (can of course be a local resource)\n\n# Call factory function to create our blueprint\nswaggerui_blueprint = get_swaggerui_blueprint(\n    SWAGGER_URL,  # Swagger UI static files will be mapped to '{SWAGGER_URL}/dist/'\n    API_URL,\n    config={\n        'app_name': 'Test application'\n    }\n)\n\napp.register_blueprint(swaggerui_blueprint)\n\n@app.route('/')\ndef hello_world():\n    return 'Hello, World!'\n\nif __name__ == '__main__':\n    app.run(debug=True)","lang":"python","description":"This example sets up a basic Flask application and registers the Swagger UI blueprint, pointing to a remote OpenAPI specification. After running, navigate to `/api/docs` in your browser to see the Swagger UI."},"warnings":[{"fix":"Review the project's GitHub for recent activity. For custom features or critical bug fixes, consider forking the repository or integrating Swagger UI manually.","message":"The `flask-swagger-ui` project is not actively maintained, though it receives occasional updates primarily for bundling the latest Swagger UI. Users requiring more active feature development or prompt bug fixes may need to consider forking the repository.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For local files, ensure `API_URL` correctly points to a Flask static route (e.g., `/static/swagger.json`) and that the file exists in the corresponding static folder.","message":"When using a local `swagger.json` or `openapi.json` file as the `API_URL`, ensure that Flask is configured to serve static files from the directory where your API definition resides. Common issues include 'Fetch error: Not Found' if the static path is incorrect or the file isn't accessible via the web server.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For advanced Swagger UI features like plugins or custom functions, you may need to integrate Swagger UI directly into your Flask application without using this blueprint, or investigate alternative Flask extensions that offer more control.","message":"The `get_swaggerui_blueprint` factory function supports overriding Swagger UI configuration options that can be JSON serialized via the `config` dictionary parameter. However, it does *not* support Swagger UI plugins or function parameters for advanced customization.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If you are using Flask-RESTX for API development, its integrated documentation might be a more seamless solution. Otherwise, ensure your API definition is separate and served correctly for `flask-swagger-ui`.","message":"`flask-swagger-ui` provides a standalone blueprint for Swagger UI. It is different from the built-in Swagger UI functionality offered by `Flask-RESTPlus` (now `Flask-RESTX`), which integrates Swagger documentation directly with API definitions.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'5.32.1':33 'activ':39,56 'api':69 'applic':26 'blueprint':18 'bundl':29,48 'consid':63 'current':28,52 'develop':57 'document':70 'featur':61 'flask':2,6,17,25,67 'flask-swagger-ui':1,5 'fork':64 'integr':20 'keep':46 'librari':12 'maintain':40 'might':62 'new':60 'occasion':43 'project':36 'provid':14 'python':11 'receiv':42 'repositori':66 'requir':54 'simpl':16 'specif':59 'swagger':3,7,21,30,49,68 'ui':4,8,22,31,50,71 'updat':44 'user':53 'version':32,51","created_at":"2026-04-14T18:34:52.000642+00:00","updated_at":"2026-04-16T15:08:26.283962+00:00","problems":[{"fix":"Ensure the package is correctly installed using pip: `pip install flask-swagger-ui`. The correct import statement is `from flask_swagger_ui import get_swaggerui_blueprint`.","cause":"The 'flask-swagger-ui' Python package has not been installed in your current environment, or the import statement uses the wrong module name.","error":"ModuleNotFoundError: No module named 'flask_swagger_ui'"},{"fix":"Verify that `SWAGGER_URL` (the path to the Swagger UI) and `API_URL` (the path to your OpenAPI specification file) in `get_swaggerui_blueprint` are correct and accessible. Ensure the blueprint is registered with your Flask app using `app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL)`.","cause":"This error occurs when the Flask application cannot find the configured Swagger UI endpoint or the `swagger.json` specification file, often due to an incorrect URL prefix or API URL in the `get_swaggerui_blueprint` function, or the application not being properly registered or running.","error":"werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server."},{"fix":"Create a Flask application instance (`app = Flask(__name__)`), register your `flask-swagger-ui` blueprint with it (`app.register_blueprint(...)`), and then run the Flask application (`app.run()`).","cause":"This error happens when you try to call the `.run()` method directly on a Flask Blueprint object. Blueprints are meant to be registered with a Flask application instance, not run independently.","error":"AttributeError: 'Blueprint' object has no attribute 'run'"},{"fix":"Ensure your Flask application is configured to serve static files correctly. If using a custom static folder, verify `static_url_path` and `static_folder` in your Flask app initialization. In production, ensure your web server (e.g., Nginx, Apache) is correctly configured to serve static assets from the appropriate paths.","cause":"The browser is failing to load the necessary CSS and JavaScript files for the Swagger UI, often resulting in 404 errors for these static resources. This can be caused by incorrect Flask static file configuration or deployment server issues where static files are not served correctly.","error":"Swagger UI static files (CSS/JS) not loading or styling is broken"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"5.32.6","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/sveint/flask-swagger-ui","docs":null,"changelog":null,"pypi":"https://pypi.org/project/flask-swagger-ui/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}