ripe-architect-1001
06/06/2024, 7:31 PMpants run src/python/bin/internal_tools/manage.py -- runserver
On the other hand this does not:
pants run src/python/bin/internal_tools:manage -- runserver
When ran it gives this error:
pex_warnings.warn(
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/me/code/org/repo/src/python/bin/internal_tools/manage.py", line 23, in <module>
main()
File "/home/me/code/org/repo/src/python/bin/internal_tools/manage.py", line 10, in main
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
I haven't been able to sort out why its not finding django.
My BUILD
file for this project is set up like this:
python_sources(
name="site",
dependencies=[
"//:root#django-browser-reload",
"//:root#django-tailwind",
"//:root#django-widget-tweaks",
"//:root#django-compressor",
"//:root#psycopg2",
"//:root#Django",
"src/python/bin/internal_tools/project:project",
"src/python/bin/internal_tools/apps:apps",
],
overrides={
"manage.py": {
"restartable": True,
}
},
)
pex_binary(
name="manage",
entry_point="manage.py",
dependencies=[
":site",
],
)
For context I've been following this repo as a bit of a guide:
https://github.com/pantsbuild/example-django/tree/main
Any insight here would be appreciated.happy-kitchen-89482
06/06/2024, 8:01 PMmanage.py
commands work? If so then this is a well-known issue with runserver
specificallyhappy-kitchen-89482
06/06/2024, 8:01 PMhappy-kitchen-89482
06/06/2024, 8:01 PMripe-architect-1001
06/06/2024, 8:20 PMrunserver
works as expected when I target the manage.py
directly. The problem is when I use the pex binary to invoke it.ripe-architect-1001
06/06/2024, 8:24 PMhappy-kitchen-89482
06/07/2024, 1:47 AMhappy-kitchen-89482
06/07/2024, 1:48 AM