MulaiMulai sekarang secara gratis

Running the FastAPI app

Your FastAPI app has been saved in a Python file called main.py. You would like to run the app from a Python script using uvicorn.

To serve your FastAPI app directly via the Python script in solution.py, you need to finish adding the code block that sets up the host and port of the server where the API will run.

Latihan ini adalah bagian dari kursus

Deploying AI into Production with FastAPI

Lihat Kursus

Petunjuk latihan

  • Import the module to spin up the uvicorn server for the API.
  • Start the uvicorn server using its run() method to run the application.
  • Configure the host to run at 0.0.0.0 and at port 8080.
  • Run the solution.py script using the python3 command in the terminal.

Latihan interaktif praktis

Ubah teori menjadi tindakan dengan salah satu latihan interaktif kami.

Mulai berolahraga