summaryrefslogtreecommitdiff
path: root/ql/settings.py
blob: df68ae390108b6b0975396e9f90743304f49fae6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import json, sys

def _fetch_settings(config_path, constant_config, default_config):
    try:
        config = constant_config.copy()
        config.update(json.load(open(config_path)))
        return config
    except FileNotFoundError:
        with open(config_path, 'w') as new_config:
            json.dump(default_config, new_config)
        print('Config file created, fill it up!')
        sys.exit()
    except ValueError:
        print('Config file invalid, fix it!')
        sys.exit(1)

DATABASES = {
    'default': _fetch_settings(
        'config.json',
        {
            'ENGINE': 'mysql.connector.django'
        },
        {
            'HOST': 'localhost',
            'PORT': '3306',
            'USER': 'root',
            'PASSWORD': '',
            'NAME': 'belongs_to_us'
        }
    )
}

INSTALLED_APPS = (
    'ql.orm',
)

SECRET_KEY = 'f5a73e42-a600-4925-a860-b40b72acf497'