Error upgrading 2.3.5 to 2.4.2

Look at /var/discourse/templates/web_only.yml (or similar, that’s by memory) for example of how to use an external database.

Once you get an empty site up you could be able to restore a backup with discourse restore.