The combination of formatting and concatenation is a bit unclear. Can you just do:
```python
sh("python manage.py {system} collectstatic --traceback --settings={env} --noinput > /dev/null".format(
    system=system, env=env)
)