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.
This exercise is part of the course
Deploying AI into Production with FastAPI
Exercise instructions
- Import the module to spin up the
uvicornserver for the API. - Start the
uvicornserver using itsrun()method to run the application. - Configure the host to run at
0.0.0.0and at port8080. - Run the
solution.pyscript using thepython3command in the terminal.
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
Start Exercise