Traceback (most recent call last):
File "/app/src/eraseme_fastapi_template/main.py", line 11, in <module>
from .config import Settings, get_settings
ImportError: attempted relative import with no known parent package
Issue is caused when running the command we print out in the devspace_start.sh
This is probably due to the fact that the PYTHONPATH ends up being set to src/eraseme_fastapi_template when main.py is run directly. The relative imports work as-is when the FastAPI application is run using poetry run dev however.
Issue is caused when running the command we print out in the
devspace_start.sh
https://github.com/bocdaz/template-python-project/blob/main/%7B%7Bcookiecutter.hyphenated%7D%7D/devspace_start.sh#L23
This is probably due to the fact that the
PYTHONPATH
ends up being set tosrc/eraseme_fastapi_template
whenmain.py
is run directly. The relative imports work as-is when the FastAPI application is run usingpoetry run dev
however.