Closed JSv4 closed 2 years ago
Thank you for using this project! I'm glad you like it ❤️ !
Yeah, that's truly an error. I fixed it in pools issue. Will release soon.
I'll close the issue when upcoming release is merged into master branch.
Awesome! Thanks for the quick response and proposed resolution!
This issue is resolved in 3.3.8. Can you please check? If it's ok, please close the issue.
Closing due to inactivity.
Closing due to inactivity.
Sorry just saw this. Thanks for the fix!
Awesome project! Really love what you've done here!
I ran into what I think is a bug with the project generation logic. I think it's a simple fix / issue, so I'd be happy to contribute a PR, but wanted to run this by you first.
In the context.py file of the gql package, there's an import for
from {{cookiecutter.project_name}}.db.dependencies import get_db_session
: https://github.com/s3rius/FastAPI-template/blob/156883798ab4ec54d97080c77a34d366b8484f95/fastapi_template/template/%7B%7Bcookiecutter.project_name%7D%7D/%7B%7Bcookiecutter.project_name%7D%7D/web/gql/context.py#L16-L18This import does not appear to be used when using Tortoise ORM, however:
https://github.com/s3rius/FastAPI-template/blob/156883798ab4ec54d97080c77a34d366b8484f95/fastapi_template/template/%7B%7Bcookiecutter.project_name%7D%7D/%7B%7Bcookiecutter.project_name%7D%7D/web/gql/context.py#L38-L42
In fact, with Tortoise ORM, there doesn't appear to be a dependencies.py file at all, see here.
Leaving the import statement throws an error with pytest:
Removing the import appears to cause no other issues and resolves the error. Seems like the if/else jinja statement in the
gql.context.py
template to import dependencies and get_db_session should be updated to also take into account which database is being used? This is my first in-depth foray into standalone Python ORMs (I've been a Django guy, mostly), so sorry if I'm missing something here.