Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 1.25 KB

File metadata and controls

72 lines (49 loc) · 1.25 KB

Installation without Docker

Env file

Create .env file in root directory :

DATABASE_USER=app
DATABASE_PASSWORD=password
DATABASE_URL=postgres-app
DATABASE_NAME=app

JWT_ACCESS_TOKEN_KEY=<random 64 char>
JWT_REFRESH_TOKEN_KEY=<random 64 char>

Installation without docker

Use at least python 3.10.

Create a virtualenv and activate it

python3 -m venv venv
source venv/bin/activate

Install requirements

pip3 install -r requirements/dev.txt # or prod.txt

Install/Configure PostgreSQL

Install PostgreSQL here.

And then create a database/user :

CREATE DATABASE app
CREATE USER app WITH PASSWORD 'password';

Database migration

If there is no versions in migrations/versions folder, execute this command :

# Generate version file
alembic revision --autogenerate -m "init"

Generate tables with Alembic

To apply your migration file to the database :

alembic upgrade head

In case of error : FAILED: Can't locate revision identified by '747e6da84866' you might delete entry in alembic_version table :

$ docker exec -it postgres-app psql -U app
DELETE FROM alembic_version;

Start FastAPI app

python3 main.py