-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.py
42 lines (31 loc) · 1007 Bytes
/
config.py
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
38
39
40
41
42
from uuid import uuid4
def load_config(filename):
config = get_default_config()
config_file_vars = {'__file__': filename}
with open(filename, 'r') as f:
exec(f.read(), config_file_vars)
config.update({
key: value
for key, value in config_file_vars.items()
if key in config
})
return config
def get_default_config():
return {
# Basics
'debug': False,
'secret_key': f'{uuid4()}',
'name': 'MiniWiki',
'database': 'sqlite:///miniwiki.db',
# Custom template & static
'template_folder': None,
'static_folder': None,
# Auth backend + settings
'auth_backend': 'miniwiki.auth.AnonymousAuthBackend',
'auth_backend_settings': {},
# Cache backend + settings
'cache_backend': 'miniwiki.cache.NoCacheBackend',
'cache_backend_settings': {},
# Optional custom app initialization callback
'init_app': lambda app: None,
}