Rather than call `collectstatic` directly, you need to be calling into the `setup` command with the `interactive=False` argument.  This will do all relevant setup (including collectstatic and migrations).