You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(I hope I describe this correctly, it is possible that I have a misunderstanding of how imports are resolved)
Problem: The FastAPI documentation on debugging suggests to call uvicorn directly from main via the IDE/Debugger. However, in this case, fastapi-nano’s imports do not seem to work, as the folder of main.py is the root folder for the module imports with this method of executing the code. So from app.core import auth fails, , from core import auth would work. The imports work when calling uvicorn directly since uvicorn app.main:app (as documented in the readme) seems to make the module resolution uses the folder uvicorn was called from as its root (that is, the project’s main folder with the folder app in it)
Possible solutions:
Assume calling from the /app folder and change paths accordingly
Document another way to debug
Dont fix/not a significant problem
The text was updated successfully, but these errors were encountered:
from core import auth comes with its fair share of issues. Can you try python -m main instead of running the main module as a script? Running python main.py puts the path of the nested package to the top of the sys.path which can have other unintended consequences. You can learn more about it here:
(I hope I describe this correctly, it is possible that I have a misunderstanding of how imports are resolved)
Problem: The FastAPI documentation on debugging suggests to call uvicorn directly from main via the IDE/Debugger. However, in this case, fastapi-nano’s imports do not seem to work, as the folder of main.py is the root folder for the module imports with this method of executing the code. So
from app.core import auth
fails, ,from core import auth
would work. The imports work when calling uvicorn directly sinceuvicorn app.main:app
(as documented in the readme) seems to make the module resolution uses the folder uvicorn was called from as its root (that is, the project’s main folder with the folder app in it)Possible solutions:
The text was updated successfully, but these errors were encountered: