https://pantsbuild.org/ logo
c

creamy-truck-92790

09/19/2022, 1:38 PM
Hello again - One more question. In django, everything seems to be correctly set up, when running shell (e.g.
./pants run backend/modules/mod1:manage -- shell
). However when I do runserver (e.g.
./pants run backend/modules/mod1:manage -- runserver
) it complains that django is not installed. (No module found...) Any idea why? it seems to disregard all installed side-packages...
h

happy-kitchen-89482

09/19/2022, 1:50 PM
There is a gotcha with
runserver
because the Django development server’s autoreloading logic does some syspath hacks that don’t interact well with pants’s sandboxing.
The solution is to do
runserver --noreload
And let Pants do the reloading
which it does more precisely anyway
Writing a Django-specific tutorial with this sort of stuff in it is on my todo list…
(to let Pants do the reloading set
restartable=True
on the pex_binary target that wraps
manage.py
)
c

creamy-truck-92790

09/19/2022, 1:55 PM
Okay that works, thatnk @happy-kitchen-89482
However, why doesn't the django example need this norelead flag?
Found it ... It uses norelead under the hood due to custom manage.py...
h

happy-kitchen-89482

09/19/2022, 2:00 PM
Ah yes, lots of hackery…
Sorry, this is poorly documented
We really should have a Django page in the docs
c

creamy-truck-92790

09/19/2022, 2:01 PM
All good - I was just very very confused 😄
i

incalculable-hydrogen-44003

09/19/2022, 9:00 PM
Oh wow. We spent days trying to fix this 😅
Thanks for the help!
3 Views