Skip to content

Commit 99865f1

Browse files
committed
Fixed redis and mongo.
1 parent 0f42bb1 commit 99865f1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

fastapi_template/template/{{cookiecutter.project_name}}/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ dependencies = [
8080
{%- endif %}
8181
{%- endif %}
8282
{%- if cookiecutter.enable_redis == "True" %}
83-
"redis[hiredis] >=7.1.0,<8",
83+
"redis[hiredis] >=6,<7",
8484
{%- endif %}
8585
{%- if cookiecutter.self_hosted_swagger == 'True' %}
8686
"aiofiles >=25.1.0,<26",

fastapi_template/template/{{cookiecutter.project_name}}/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
{%- elif cookiecutter.orm == "beanie" %}
7070
import beanie
71-
from motor.motor_asyncio import AsyncIOMotorClient
71+
from pymongo import AsyncMongoClient
7272

7373
{%- endif %}
7474

@@ -347,7 +347,7 @@ async def setup_db() -> AsyncGenerator[None, None]:
347347
348348
:yield: nothing.
349349
"""
350-
client = AsyncIOMotorClient(settings.db_url.human_repr()) # type: ignore
350+
client = AsyncMongoClient(settings.db_url.human_repr()) # type: ignore
351351
from {{cookiecutter.project_name}}.db.models import load_all_models
352352
await beanie.init_beanie(
353353
database=client[settings.db_base],

fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/web/lifespan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ def _setup_db(app: FastAPI) -> None: # pragma: no cover
130130

131131
{%- if cookiecutter.orm == "beanie" %}
132132
import beanie
133-
from motor.motor_asyncio import AsyncIOMotorClient
133+
from pymongo import AsyncMongoClient
134134
from {{cookiecutter.project_name}}.db.models import load_all_models
135135
async def _setup_db(app: FastAPI) -> None:
136-
client = AsyncIOMotorClient(str(settings.db_url)) # type: ignore
136+
client = AsyncMongoClient(str(settings.db_url)) # type: ignore
137137
app.state.db_client = client
138138
await beanie.init_beanie(
139139
database=client[settings.db_base],

0 commit comments

Comments
 (0)