happy-family-315
02/07/2023, 1:17 PMhappy-family-315
02/07/2023, 1:20 PM./pants run django/manage.py
works but pants run django:manage
where manage this target does not work and results in a SECRET_KEY not found error. How does the first command find my secret key (its not set in my bash environment but only in env_vars_run_django()
)
pex_binary(
name="manage",
entry_point="manage.py",
restartable=True,
environment="linux_devcontainer",
)
local_environment(name="local-django-manage", subprocess_environment_env_vars=env_vars_run_django())
enough-analyst-54434
02/07/2023, 2:04 PMenough-analyst-54434
02/07/2023, 2:04 PMhappy-family-315
02/07/2023, 3:49 PMrun
goal so that pants run django:manage
builds the pex binary and then passes the environment variables not while building but during runtime. I thought environment="linux_devcontainer"
would do this but it seems to do nothing.enough-analyst-54434
02/07/2023, 4:28 PMenough-analyst-54434
02/07/2023, 4:35 PMpants run
with no extra effort (targets or config) on your part.happy-family-315
02/08/2023, 9:10 AMenough-analyst-54434
02/08/2023, 2:15 PMFOO=bar BAZ=spam ./pants run ...
2. Define a pex_binary target for normal use + define another with the FOO
and BAZ
env vars sealed in
You want instead ... ?enough-analyst-54434
02/08/2023, 2:17 PMrun
option to pass env vars. That's too broad a scope though since it sounds like you want to pass the env vars only to a certain run
target. Options 1 & 2 cover that case.