error message if config could not be loaded

This commit is contained in:
Laura Klünder 2018-12-08 02:54:08 +01:00
parent 5e134e5b41
commit e4c7fd508e

View file

@ -11,8 +11,10 @@ from django.utils.crypto import get_random_string
from django.utils.translation import ugettext_lazy as _
config = configparser.RawConfigParser()
config.read(['/etc/c3nav/c3nav.cfg', os.path.expanduser('~/.c3nav.cfg'), os.environ.get('C3NAV_CONFIG', 'c3nav.cfg')],
encoding='utf-8')
if 'C3NAV_CONFIG' in os.environ:
config.read_file(open(os.environ.get('C3NAV_CONFIG'), encoding='utf-8'))
else:
config.read(['/etc/c3nav/c3nav.cfg', os.path.expanduser('~/.c3nav.cfg'), 'c3nav.cfg'], encoding='utf-8')
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))