I have a webapp that I made using django that I need to deploy to many raspberry pi devices. I'm using ansible to automate the deployment to devices. While developing the app I used pipenv to manage my project dependencies in a virtual environment.
My question is, is it necessary to make a virtual environment on the actual raspberry pi devices when deploying or can I just install all my necessary packages on the system environment? What are the advantages of making a virtual environment on the device?
Thank you.
Separating your apps' dependencies from systems' is always a good idea. The overhead is minimal and may prevent issues in the future. It makes it much easier to tear down and rebuild your app if you ever need to, rather than potentially having to re-image the raspberry pi if anything goes wrong. It also means you have the ability to run separate apps on the pi that don't need to be running off the same package versions, should you ever want to do that.
However, it's certainly possible not to use one and you might get away with it and not have any issues. But if you want to improve the reliability and maintainability of your app and pi, and considering how easy it is to setup and use, it seems like a poor design decision not to use it.
Python virtualenv when deploying webapp to raspberry pi?