Out of repo settings

Files that contain private information like passwords, secrets, and host names shouldn't be under revision control.
This commit is contained in:
Cy 2020-05-30 08:02:36 +00:00 committed by user
parent 00e35409ef
commit d5f3b4e1de
No known key found for this signature in database
GPG Key ID: F66D599380F88521
2 changed files with 35 additions and 1 deletions

View File

@ -25,7 +25,7 @@ This will depend on your server setup, and you should consult [Deploying Django]
One common step would be to install dependencies like this: `PIPENV_VENV_IN_PROJECT=1 pipenv install`. This will install dependencies within the project folder.
Then edit brutaldon/settings.py. You definitely need to change the values of SECRET_KEY and ALLOWED_HOSTS. Also edit the database parameters to match the database you chose. Then run `pipenv run python ./manage.py migrate` to populate the database.
Then create the file ~/.config/brutaldon_settings.py which overrides anything in brutaldon/settings.py. You definitely need to override SECRET_KEY and ALLOWED_HOSTS. Also edit the database parameters to match the database you chose. Then run `pipenv run python ./manage.py migrate` to populate the database.
I installed brutaldon with Apache and mod_wsgi. If you installed brutaldon in /usr/local/share/, you'd add config lines something like this to the virtual host brutaldon is installed in.

View File

@ -205,3 +205,37 @@ GAB_RICKROLL_URL = "https://invidio.us/watch?v=dQw4w9WgXcQ"
# Version number displayed on about page
BRUTALDON_VERSION = "2.14.1"
# Load custom settings outside repository tracked files, so private settings
# don't get added to the repository
import sys
def paths():
sys.path.append('???')
try:
from xdg import XDG_CONFIG_HOME, XDG_CONFIG_DIRS
except ImportError:
try:
from pathlib import Path
except ImportError:
home = os.environ['home']
else:
home = Path.home()
sys.path[-1] = os.path.join(home, ".config")
yield
sys.path[-1] = home
yield
else:
sys.path[-1] = XDG_CONFIG_HOME
yield
for directory in XDG_CONFIG_DIRS:
sys.path[-1] = directory
yield
finally:
sys.path.pop(-1)
for _ in paths():
try:
from brutaldon_settings import *
except ImportError: pass
else:
break