https://github.com/samk13/python-fast-api
https://github.com/samk13/python-fast-api
python
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/samk13/python-fast-api
- Owner: Samk13
- Created: 2021-11-02T22:37:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-21T09:09:48.000Z (over 4 years ago)
- Last Synced: 2025-02-16T22:27:05.540Z (over 1 year ago)
- Topics: python
- Language: Python
- Homepage: https://sam-arbid-fastapi.herokuapp.com/docs
- Size: 162 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
[](https://github.com/pre-commit/pre-commit)
[](https://pycqa.github.io/isort/)
[](https://github.com/psf/black)
# Fast API for Python
## setup:
make sure the venv is activated
run:
```bash
venv/Scripts/activate.bat
mac:
source venv/Script/activate
```
to deactivate the venv:
deactivate
---
If you get errors with pip not found:
solution:
```bash
python -m ensurepip
```
to remove the **pycache** folder:
[link](http://www.randallkent.com/2010/04/30/gitignore-not-working/)
[github](https://github.com/martinohanlon/flightlight/issues/1)
```zsh
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](https://youtu.be/0sOvCWFmrtA?t=38242)
## 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:
```bash
heroku run "alembic upgrade head"
```
> Make sure after installing Heroku cli to close your terminal and restart VS code.
## Access postgres db from ssh:
### [setup postgres config to be accessed with ssh](https://youtu.be/0sOvCWFmrtA?t=44246)
---
### [Auto reboot app on restart setup service](https://youtu.be/0sOvCWFmrtA?t=46455)
---
### [Auto reboot app on restart](https://youtu.be/0sOvCWFmrtA?t=47042)
---
### [Setup Nginx](https://youtu.be/0sOvCWFmrtA?t=47088)
---
### [Setup HTTPS](https://youtu.be/0sOvCWFmrtA?t=47445)
---
### [Setup SSL](https://youtu.be/0sOvCWFmrtA?t=47723)
---
### [Setup Firewall](https://youtu.be/0sOvCWFmrtA?t=48013)
---
### [Setup app using Docker](https://youtu.be/0sOvCWFmrtA?t=48380)
---
### [Setup Docker compose](https://youtu.be/0sOvCWFmrtA?t=49121)
---
### [Optimize Docker for production](https://youtu.be/0sOvCWFmrtA?t=50942)
---
### [Deal with authentication testing](https://youtu.be/0sOvCWFmrtA?t=59311)
---
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](https://sam-arbid-fastapi.herokuapp.com/docs)
# Start the Server:
```zsh
uvicorn app.main:app --reload
```
# run tests:
```zsh
pytest -v -rP
```