Sign inSign up

meschac38000/fast-api

By meschac38000

Updated over 4 years ago
Archived

This is not fastApi framework image. It's a little api built with FastApi

Image
Developer tools
1

1.1K

meschac38000/fast-api repository overview

Get started Python FastAPI

codecov Workflow Lint Code style: black Pypi made-with-python CC-0 license

Client code

Client App

Python versions

>= 3.9

Install with docker-compose

Move to the app folder

cd app

Then run:

docker-compose -f docker-compose.yml up

The app running on http://127.0.0.1:8000/

Manual installation without docker

Note that, you can create a virtual environment if you don't want to install requirements in your host machine

For that run the following commands

python -m venv {choose-name}

activate this virtual environment

Linux or Mac

source {choose-name}/bin/activate

Windows

./{choose-name}/Scripts/activate

Move to app folder

cd app/
Install requirements

Upgrade pip

pip install --upgrade pip

install application requirements

pip install -r  requirements/common.txt

install dev requirements (useful to run tests)

pip install -r requirements/dev.txt
Database

Connect to your postgres BD using psql

psql -U {postgres_user} -p {port_5432} -h {host}

Then create DB fastapidb

CREATE DATABASE fastapidb;

Then Edit TORTOISE_ORM variable in the settings.py correctly. You will find settings file in api/api_v1 folder

Then run migrations using aerich command to create table(s).

aerich init -t api.api_v1.settings.TORTOISE_ORM
aerich init-db

Run the app

python main.py

The app running on http://127.0.0.1:8000/

Fake Data

To load some fake data, go to http://127.0.0.1:8000/data which will load fake data and redirect you to the app root /

Run all the tests

from app folder run:

pytest

Tag summary

Content type

Image

Digest

Size

63.5 MB

Last updated

over 4 years ago

docker pull meschac38000/fast-api