Using Python's venv with Nixpacks Custom Commands
The Nixpacks build system uses Python's
venv module to create a virtual environment when building your application from source code.
Because of this, you may run into problems when you supply your own commands for building, installing, or starting your application.
We recommend adding the following code in front of any custom commands you specify for your Python application:
python -m venv /opt/venv && . /opt/venv/bin/activate &&
For example, you may supply a new build command such as
python manage.py build, which would become:
python -m venv /opt/venv && . /opt/venv/bin/activate && python manage.py build
This should ensure that your application builds and runs in the Python virtual environment.