How to debug inside pycharm ?
masoodkamyab opened this issue · comments
Hi to every one,
I want to debug with PyCharm debugger
run my tests and see all variables and traces. but it seems it didn't load the .env
file so I have an error that some critical environment variable is missing (note that I don't want to use docker to run my tests).
here some error that I got:
ImportError while loading conftest '/home/has/project/backend/app/app/tests/conftest.py'.
../conftest.py:7: in <module>
from app.core.config import settings
../../core/config.py:90: in <module>
settings = Settings()
pydantic/env_settings.py:39: in pydantic.env_settings.BaseSettings.__init__
???
pydantic/main.py:341: in pydantic.main.BaseModel.__init__
???
E pydantic.error_wrappers.ValidationError: 11 validation errors for Settings
E SERVER_NAME
E field required (type=value_error.missing)
E SERVER_HOST
E field required (type=value_error.missing)
E PROJECT_NAME
E field required (type=value_error.missing)
E SENTRY_DSN
E object of type 'NoneType' has no len() (type=type_error)
E POSTGRES_SERVER
E field required (type=value_error.missing)
E POSTGRES_USER
E field required (type=value_error.missing)
E POSTGRES_PASSWORD
E field required (type=value_error.missing)
E POSTGRES_DB
E field required (type=value_error.missing)
E SQLALCHEMY_DATABASE_URI
E can only concatenate str (not "NoneType") to str (type=type_error)
E FIRST_SUPERUSER
E field required (type=value_error.missing)
E FIRST_SUPERUSER_PASSWORD
E field required (type=value_error.missing)
If anybody can help me I will appreciate it.
thanks
I also have this problem, this framework is currently unfriendly to collaborative development, everyone should not run a docker for development
You can use the EnvFile plugin so that you can explicitly tell PyCharm to load an env file in a run configuration. Very useful.
https://plugins.jetbrains.com/plugin/7861-envfile