OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How do I access FastAPI url from my application?

  • Thread starter Thread starter Alexander Obidiegwu
  • Start date Start date
A

Alexander Obidiegwu

Guest
I deployed my FastAPI backend application on a server using docker. However, when I try to access the URL provided (https://0.0.0.0:8000) from my front-end react application which doesn't use docker, I get the error: https://0.0.0.0:8000/login net::ERR_ADDRESS_INVALID.

Dockerfile:

Code:
FROM python:3.12

COPY requirements.txt requirements.txt

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["fastapi", "run", "db.py", "--port", "8000"]

My FastAPI application and docker file is in the /backend directory of my react application. Assuming my domain is www.example.com, how do I access the application running on uvicorn which using http://0.0.0.0:8000. I am new to docker so forgive me if they have no relation to each other.

Usually you just access scripts like www.example.com/backend/db but with docker, it's a bit difficult to understand what I am supposed to do.
<p>I deployed my FastAPI backend application on a server using docker. However, when I try to access the URL provided (<a href="https://0.0.0.0:8000" rel="nofollow noreferrer">https://0.0.0.0:8000</a>) from my front-end react application which doesn't use docker, I get the error: <code>https://0.0.0.0:8000/login net::ERR_ADDRESS_INVALID</code>.</p>
<p>Dockerfile:</p>
<pre><code>FROM python:3.12

COPY requirements.txt requirements.txt

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["fastapi", "run", "db.py", "--port", "8000"]
</code></pre>
<p>My FastAPI application and docker file is in the /backend directory of my react application. Assuming my domain is <a href="http://www.example.com" rel="nofollow noreferrer">www.example.com</a>, how do I access the application running on uvicorn which using <a href="http://0.0.0.0:8000" rel="nofollow noreferrer">http://0.0.0.0:8000</a>. I am new to docker so forgive me if they have no relation to each other.</p>
<p>Usually you just access scripts like <code>www.example.com/backend/db</code> but with docker, it's a bit difficult to understand what I am supposed to do.</p>
 

Latest posts

Top