https://pantsbuild.org/ logo
#general
Title
# general
i

incalculable-hydrogen-44003

11/01/2022, 7:47 PM
Hi guys. Quick question. We are trying to run django migrations inside of the pex binary, but the migration files end up being generated inside the sandbox, which means they go away. To get around this, we have been running with
-no-run-cleanup
to preserve the files, but it is tedious to copy the files out of the pex sandbox. Anybody dealt with this and have a good solution?
h

happy-kitchen-89482

11/01/2022, 7:48 PM
Hi, which Pants version? And what command are you running?
We have solutions for this and several other Djangoisms, that I should really document…
c

clean-city-64472

11/01/2022, 7:49 PM
Have this handy because we were just looking at it: https://www.pantsbuild.org/docs/python-run-goal#execution-semantics
run_goal_use_sandbox = False
is likely what you need
i

incalculable-hydrogen-44003

11/01/2022, 7:50 PM
We are running
2.12.0
and running
./pants run --no-run-cleanup src/xxx/manage.py -- makemigrations xxx
omg...i'm not sure how we missed this. will try it out now
h

happy-kitchen-89482

11/01/2022, 7:55 PM
So in Pants 2.13 doing
run path/to/manage.py
will not run in a sandbox, while
run path/to:manage_target
will run in a sandbox, but in 2.12 that field is what you need
i

incalculable-hydrogen-44003

11/01/2022, 8:01 PM
So we just tried updating to 2.13 and it still generated inside a tmp
Where do we put
run_goal_use_sandbox
^ adding
run_goal_use_sandbox
in fact worked
h

happy-kitchen-89482

11/01/2022, 8:05 PM
Oh, maybe it’s 2.14
@bitter-ability-32190?
b

bitter-ability-32190

11/01/2022, 8:06 PM
We haven't changed the default semantics yet. There's some FUD around it. So in every version it'll always default to sandboxing
(Although https://github.com/pantsbuild/pants/issues/17372 means you might never run in the sandbox 😅 but thats a bug )
i

incalculable-hydrogen-44003

11/01/2022, 8:08 PM
lol. ok. thanks guys
5 Views