From ae2f1c696ce65635cb499c92b5f914c84a3aece9 Mon Sep 17 00:00:00 2001 From: androiddrew Date: Mon, 21 Jan 2019 13:34:48 -0500 Subject: [PATCH] Added property to ExtApp for easy access to settings --- .../{{cookiecutter.project_slug}}/index.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/index.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/index.py index 34df416..e3e60fb 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/index.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/index.py @@ -1,6 +1,6 @@ import os from typing import Tuple -from molten import App, Route, ResponseRendererMiddleware +from molten import App, Route, ResponseRendererMiddleware, Settings from molten.http import HTTP_404, Request from molten.openapi import Metadata, OpenAPIHandler, OpenAPIUIHandler from molten.settings import SettingsComponent @@ -53,6 +53,14 @@ class ExtApp(App): ), ) + @property + def settings(self): + def _get_settings(_settings: Settings): + return _settings + + settings = self.injector.get_resolver().resolve(_get_settings)() + return settings + def create_app(_components=None, _middleware=None, _routes=None, _renderers=None): """