Git Product home page Git Product logo

test-fastapi's Introduction

Get started Python FastAPI

codecov Build Docker image Code style: black Pypi made-with-python CC-0 license

Client apps

Versions

3.9 <= python <= 3.10.4

NOTE: All database configuration names can be overridden by environment variables see settings.py file


Install with docker-compose

Then run:

docker-compose -f docker-compose.yml up

Mixed install with docker and host machine:

If you have already postgres installed in your host machine then:

Create database fastapidb

create database fastapidb; 

Run app with docker:

docker run -d --rm --network=host meschac38000/fast-api:latest

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

Manual installation without docker

requirements:
- Postgresql
- python

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 command depending on your system:

python -m venv {venv-name}

activate this virtual environment

Linux or Mac

source {venv-name}/bin/activate

Windows

./{venv-name}/Scripts/activate

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 -p 5432 -h localhost

Then create DB fastapidb

CREATE DATABASE fastapidb;

Then edit correctly TORTOISE_ORM variable in the settings.py file.

We are using Aerich as database migrations tool. Init database by running the following aerich command:

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.

Run all the tests

from root folder(Test-FastAPI/) run:

pytest

Contributors

Made by:

image

test-fastapi's People

Contributors

meschac38700 avatar

Watchers

James Cloos avatar  avatar

test-fastapi's Issues

PUT PATCH

Review code PUT method and patch logic

Filter get users

Add filter by attribute on get users route:
ex: /users/filter/first_name/john or /users/?first_name=john

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.