]> git.zarvox.org Git - imoo.git/blob - config.py
Fix misnamed parameter in log line
[imoo.git] / config.py
1 import os
2
3 basedir = os.path.abspath(os.path.dirname(__file__))
4
5 # SQLAlchemy connection string
6 SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'state', 'database.db')
7
8 # CSRF protection: generate a CSRF secret key if none exists
9 CSRF_ENABLED=True
10 csrf_keyfile = os.path.join(basedir, 'state', 'csrf_secret')
11 if not os.path.exists(csrf_keyfile):
12     with open("/dev/urandom") as rng:
13         key = rng.read(64)
14     with open(csrf_keyfile, "w") as f:
15         f.write(key)
16
17 with open(csrf_keyfile) as f:
18         SECRET_KEY = f.read()