Rest API with Python: FastAPI

Rest API with Python: FastAPI

FastAPI Setup Guide

Use the following commands to instal FastAPi on your local environment.(Mac/Windows)

  • Mac
  • Windows

Mac Commands

cd Desktop
cd API

Navigate to the Desktop and then into the API project folder.

Check Python Version

python3 --version

Check if Python version 3.6 or above is installed.

Install Virtual Environment

pip3 install virtualenv

Install virtualenv using Python 3’s pip.

Create Virtual Environment

virtualenv env

Create a new virtual environment named ’env'.

Activate Virtual Environment

cd env
source bin/activate

Activate the virtual environment.

Return to Main API Directory

cd ..

Return to the main API project directory.

Install FastAPI

pip3 install fastapi

Install FastAPI using pip3.

Install Uvicorn

pip3 install uvicorn

Install Uvicorn, an ASGI server for FastAPI.

Windows Commands

cd Desktop
cd API

Navigate to the API project folder.

Check Python Version

python --version

Check if Python version 3.6 or above is installed.

Install Virtual Environment

pip install virtualenv

Install virtualenv using pip.

Create Virtual Environment

virtualenv env

Create a new virtual environment named ’env'.

Activate Virtual Environment

cd env
cd Scripts
activate

Activate the virtual environment.

Return to Main API Directory

cd ..

Return to the main API project directory.

Install FastAPI and Uvicorn

pip install fastapi
pip install uvicorn

Install FastAPI and Uvicorn.


comments powered by Disqus

Related Posts

The 3 Pathways of Modern Application Development on AWS

The 3 Pathways of Modern Application Development on AWS

The 3 Pathways of Modern Application Development on AWS Modern application development is essential for businesses looking to innovate, reduce costs, accelerate time to market, and improve reliability.

Read More
Python Programming Simplified: An Insider's Guide to Core Concepts

Python Programming Simplified: An Insider's Guide to Core Concepts

Python Comprehensive Cheat Sheet 1 Primitive Datatypes and Operators # You have numbers Example: 4 # => 4 Math is what you would expect Example: 2 + 2 # => 2 Example: 8 - 2 # => 8 Example: 20 * 2 # => 20 Example: 46 / 6 # => 8.

Read More
Introduction to Microservices: the essential guide

Introduction to Microservices: the essential guide

Explore the intricacies of microservices architecture, an innovative approach to designing and deploying applications as a collection of loosely coupled services.

Read More