Showing results for 
Search instead for 
Did you mean: 

Can't properly load Swagger UI - “Not Found /openapi.json”

New Member

Can't properly load Swagger UI - “Not Found /openapi.json”

I made a simple REST API with Python, Flask, Connexion and Swagger. All is working well on my local machine (Windows 10), but not on our server (Debian). I made a mod_wsgi application that is working with Apache2. I can see it is running: if i go to my assigned url <ip>/test. I can see my rendered "Hello World" HTML page. 




The reason I use Swagger is that it is easy to explore the API and serves as documentation. However, the actual UI is not loading. When I visit <ip>/test/ui, I can see the Swagger logo, but it is displaying Fetch error, Not Found /openapi.json. I made a screenshot. 




This is the code I used as my Python application:



from flask import render_template
import connexion

# Create the application instance
app = connexion.App(__name__, specification_dir='./')

# Read the swagger.yml file to configure the endpoints

# Create a URL route in our application for "/"
def home():
    This function just responds to the browser ULR
    :return: the rendered template 'home.html'
    return render_template('home.html')

# If we're running in stand alone mode, run the application
if __name__ == '__main__':


In the same folder as the Python and WSGI file is a swagger.yml present. I tried duplicating it to JSON and YAML and changing the `app.add_api` call, but no result. Also tried making a seperate folder for the yml, yaml or JSON file, no result either.




Re: Can't properly load Swagger UI - “Not Found /openapi.json”

Which full URL does your 'openapi.json' file end up being hosted on at the server?

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓