diff --git a/doc/install.rst b/doc/install.rst index dda788a0a5c1018140f27ce5eeb3aad3a3642215..b2b1f17634524585fed7d464e61f0338c3881dc2 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -42,7 +42,7 @@ The impatient can run Mutalyzer without a database server and more such nonsense with the following steps:: $ pip install -r requirements.txt - $ MUTALYZER_SETTINGS=/dev/null python -m mutalyzer.entrypoints.website + $ python -m mutalyzer.entrypoints.website This starts the website frontend on the reported port using an in-memory SQLite database. diff --git a/mutalyzer/config/__init__.py b/mutalyzer/config/__init__.py index 462a490e1bf21d18d7bca310e732ec95bd1f2e62..13c034437185b24d024d425cdcf2869588df4b25 100644 --- a/mutalyzer/config/__init__.py +++ b/mutalyzer/config/__init__.py @@ -16,6 +16,8 @@ from __future__ import unicode_literals import collections import os +import warnings + import flask.config @@ -65,10 +67,15 @@ class LazySettings(util.LazyObject): self._wrapped = Settings() self._wrapped.from_object('mutalyzer.config.default_settings') if from_environment: - # Todo: We crash if the environment variable is not set. Perhaps - # it is more user-friendly if we fall back on ./settings.py or - # ~/mutalyzer_settings.py or something if it exists. - self._wrapped.from_envvar(ENVIRONMENT_VARIABLE) + if ENVIRONMENT_VARIABLE in os.environ: + self._wrapped.from_envvar(ENVIRONMENT_VARIABLE) + else: + warnings.warn('The environment variable \'%s\' is not set ' + 'and as such default configuration settings ' + 'are used. Set this variable and make it point ' + 'to a configuration file to customize ' + 'configuration.' % ENVIRONMENT_VARIABLE, + RuntimeWarning) def configure(self, settings): """