Skip to content
Discussion options

You must be logged in to vote

Hi @auh83
Edit SQLALCHEMY_DATABASE_URI with this code

SQLITE_DB_FILE: str = ""
@computed_field  # type: ignore[prop-decorator]
@property
def SQLALCHEMY_DATABASE_URI(self) -> str | PostgresDsn:
        if self.SQLITE_DB_FILE:
            return f"sqlite:///{self.SQLITE_DB_FILE}"
        else:
            return MultiHostUrl.build(
            scheme="postgresql+psycopg",
            username=self.POSTGRES_USER,
            password=self.POSTGRES_PASSWORD,
            host=self.POSTGRES_SERVER,
            port=self.POSTGRES_PORT,
            path=self.POSTGRES_DB,
        )

and in your .env file SQLITE_DB_FILE=my_db.sqlite --> python backend\app\initial_data.py

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ubidev
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
3 participants