Changeset - c795e1799c86
[Not reviewed]
0 1 0
Ben Sturmfels (bsturmfels) - 2 months ago 2024-03-20 03:42:10
ben@sturm.com.au
Move secrets.json to top-level
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
conservancy/settings/prod.py
Show inline comments
...
 
@@ -18,24 +18,24 @@ MANAGERS = [
 
    ('Bradley M. Kuhn', 'sysadmin@sfconservancy.org'),
 
]
 

	
 
DATABASES = {
 
    'default': {
 
        'NAME': '/var/lib/www/database/conservancy-website.sqlite3',
 
        'ENGINE': 'django.db.backends.sqlite3',
 
    }
 
}
 

	
 
# Apache/mod_wsgi doesn't make it straightforward to pass environment variables
 
# to Django (can't use the Apache config).
 
with open(BASE_DIR / 'secrets.json') as f:
 
with open(BASE_DIR.parent / 'secrets.json') as f:
 
    secrets = json.load(f)
 

	
 
def get_secret(secrets, setting):
 
    try:
 
        return secrets[setting]
 
    except KeyError:
 
        raise ImproperlyConfigured(f'Missing secret \'{setting}\'')
 

	
 
SECRET_KEY = get_secret(secrets, 'SECRET_KEY')
 

	
 
SESSION_COOKIE_SECURE = True
0 comments (0 inline, 0 general)