TC = terminal command
TC: python -m venv .venv
TC: source .venv/bin/activate
TC: pip install fastapi
TC: pip install sqlalchemy
TC: pip install alembic
TC: pip install pyjwt
TC: pip install "passlib[bcrypt]"
TC: pip install psycopg2
There are a few ways to do this. Click here for the PostgreSQL documentation
migrate down:
TC: alembic downgrade base
migrate up:
TC: alembic revision
create a secret key for the security protocol
TC: openssl rand -hex 32
copy the string and paste it in the .env as:
SECRET_KEY={your secret key}
after you've created a postgreSQL database, put the following code into the .env file:
DATABASE_URL=postgresql://{username}:{password}@localhost/{dbname}
TC: fastapi dev app/api/main.py