{"id":26414098,"url":"https://github.com/nzac/flask-environment","last_synced_at":"2026-03-07T17:31:29.465Z","repository":{"id":57430295,"uuid":"38585683","full_name":"nZac/flask-environment","owner":"nZac","description":"A configuration library for Flask with support for TOML","archived":false,"fork":false,"pushed_at":"2017-02-24T15:50:06.000Z","size":23,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T15:18:21.977Z","etag":null,"topics":["configuration-by-environment","flask","flask-environment","python","toml"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nZac.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-05T21:59:09.000Z","updated_at":"2019-09-24T06:10:50.000Z","dependencies_parsed_at":"2022-08-26T04:43:36.653Z","dependency_job_id":null,"html_url":"https://github.com/nZac/flask-environment","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nZac%2Fflask-environment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nZac%2Fflask-environment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nZac%2Fflask-environment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nZac%2Fflask-environment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nZac","download_url":"https://codeload.github.com/nZac/flask-environment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244130279,"owners_count":20402753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration-by-environment","flask","flask-environment","python","toml"],"created_at":"2025-03-17T23:57:47.557Z","updated_at":"2026-03-07T17:31:29.409Z","avatar_url":"https://github.com/nZac.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Flask-Environment\n#################\n\n.. image:: https://circleci.com/gh/nZac/flask-environment/tree/master.svg?style=svg\n    :target: https://circleci.com/gh/nZac/flask-environment/tree/master\n\nConfigure a Flask applications with various configuration formats.\n\nVersion\n-------\n\n0.1.0\n\nDescription\n-----------\n\nConfigure Flask applications with other file formats like TOML. The killer\nfeature of Flask-Environment is the ability to adjust settings without multiple\nconfiguration files.\n\nSupports Python 2.7, 3.4, 3.5.\n\nInstallation\n------------\n\n.. code::\n\n  $ pip install flask-environment\n\n\n.. code::\n\n  $ pip install flask-environment[TOML]\n\n\nUsage Flask\u003e0.10\n----------------\n\n.. code::\n\n  import flask\n  from flask_environment import Config\n\n  class MyApp(flask.Flask):\n      config_class = Config\n\n  app = MyApp(__name__)\n  app.config.from_toml('config.toml')\n\n\nEnvironments\n------------\n\nFlask-Environment adds the idea of environments to a configuration file. For\ndifferent situations you might change the configuration even when the\napplication is deployed to the same machine, this is most helpful with testing.\nYou probably want to use a different database for testing than what you do for\nregular development.\n\nFlask-Environment solves this problem with the concept of environments. Within a\nconfiguration file, create a new dict called ``environments`` with the keys being\nthe name of the different environments you intend to declare.\n\nActivate an environment like this:\n\n\n.. code::\n\n  app.config.from_toml('config.toml', environment='testing')\n\nThis will load all the default settings (everything not in an environment)\nand then the specified environment. Here is a sample TOML file demonstrating the\nidea.\n\n.. code::\n\n  SUPER_COOL_FEATURE = true\n  DEBUG = false\n\n  [environments.dev]\n  DEBUG = true\n\n  [environments.testing]\n  TESTING = true\n\nIf we loaded the ``dev``` environment, the application debug flag would be set to\n``True`` and ``SUPER_COOL_FEATURE`` would be available.\n\nWhile you could use this to provision different logical environments in the same\nfile (beta, production) there really isn't a point. Environments are for\nchanging configurations within the same logical environments. Maybe you have a\nproduction environment that spawns two apps that need two diverging\nconfigurations, environments fill that need.\n\nLicence\n-------\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnzac%2Fflask-environment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnzac%2Fflask-environment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnzac%2Fflask-environment/lists"}