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

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

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.

Summary ID
Update rb-site to Use a template file to generate settings_local.py.
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.
0277b8317f57a9c6553e1695f847e8d1975eccca
Description From Last Updated

Did you forget to add the settings_local.py.in file?

daviddavid

F401 'django.template.Template' imported but unused

reviewbotreviewbot

F401 'django.template.Context' imported but unused

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. 
      
  2. Show all issues

    Did you forget to add the settings_local.py.in file?

    1. Looks like. I had it in there originally, but split up the change and did a git reset HEAD^. Must not have re-added it.

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (e8cb467)