Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for .env file. Close Issue zerasul#32. This Pull Request adds support to define blask settings using a .env file. **Usage** Add an .env file in the root folder defining the variables FLASK_APP, templateDir, postDir, defaultLayout, staticDir, title. (Use .env.example as template) `$ pipenv shell` will launch the virtualenv and automatically create environment variables from .env **Behaviour** In order to ensure backwards compatibility, the following precedence is considered to define blask settings: 1. if the environment variable BLASK_SETTINGS exists, the settings are loaded from this module (e.g. settings.py) 2. otherwise, environment variables, and finally default values are used 3. in any case, whenever Blask() is called with arguments, they always take precedence **Description of changes** * blask/blasksettings.py - in `BlaskSettings.__init__()``, replace default settings with environment variables. Add clarifications to docstring and comments. * blask/blaskcli.py - fix typos in comments and docstrings, minor code formatting * tests/settings_test.py - temporarily delete environment variables before the tests and restore them afterwards. Add test_from_dotenv() to test with environment variables All tests passed. Close zerasul#32.
- Loading branch information