Update rb-site to Use a template file to generate settings_local.py.

Review Request #11372 — Created Jan. 12, 2021 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

Previously, rb-site would hand-craft a settings_local.py for the
generated site. This was a bit messy to maintain, though, and very
limiting. A request we've had in the past is to allow a custom template
to be passed to rb-site, and we had no way to offer this for this
file.

This change moves us to using a template file, in the same format as the
others we generate (like for crontabs). We build the data up-front, pass
it to the template, and write it to the site directory.

There are some differences. Because we're having to use json to
generate the structured data, we're stuck with some annoyances like a
lack of trailing commas in lists/dictionaries, and double quotes instead
of single quotes. Not a big deal, since this file isn't meant to be
worked with all that much, and these are purely stylistic differences,
but there isn't a better approach without a whole lot of extra work.

Unit tests pass.

Ran rb-site install and verified the resulting file looked correct and
had the proper generated settings.

Commits

Files