Skip to content

Samk13/Python-fast-api

Repository files navigation

pre-commit Imports: isort Code style: black

Fast API for Python

setup:

make sure the venv is activated run:

venv/Scripts/activate.bat

mac:
    source venv/Script/activate

to deactivate the venv: deactivate


If you get errors with pip not found: solution:

python -m ensurepip

to remove the pycache folder: link github

git rm -r --cached . && git add . && git commit -m "fixing .gitignore"

Postman:

setup environment variable:

next to header and body, choose "Tests" paste the following: pm.environment.set("JWT", pm.response.json().access_token); this will set the environment variable JWT to the value of the access_token you can set the variable in Environment left tab in Postman

  • you can also set URL variable and replace your URL with {{url}}

Setup Alembic:

Setup Alembic

run migration on heroku postgres db:

If you are on windows machine: You should not use gitbas to run the commends, instead use powershell or cmd as follows:

heroku run "alembic upgrade head"

Make sure after installing Heroku cli to close your terminal and restart VS code.

Access postgres db from ssh:












flags: pytest --disable-warnings -> disable warnings pytest -v -> verbose pytest -s -> show output pytest -x -> exit on first failure pytest -v -rP -> Captured stdout calls like print statements

my Horuku

Start the Server:

uvicorn app.main:app --reload

run tests:

pytest -v -rP