[Python] Facing issue while loading FastAPI swagger URL

Discussão em 'Python' iniciado por Stack, Agosto 4, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to run FastAPI application using uvicorn and I am using Python for this. After running the command "uvicorn app.main:app --host 0.0.0.0 --port 8000 --log-level debug", I am able to get the "Hello" message while accessing the URL but the moment I try to access the swagger document it shows the below error:

    Fetch error:

    Failed to fetch http://0.0.0.0:8000/openapi.json


    Fetch error:

    Possible cross-origin (CORS) issue? The URL origin (http://0.0.0.0:8000) does not match the page (http://127.0.0.1:8000). Check the server returns the correct 'Access-Control-Allow-*' headers.


    Could anyone please help as I am new to this and kind of struggling.

    I am expecting the swagger document to load successfully.

    Continue reading...

Compartilhe esta Página