From efbd721f20cbe21ae5350380035752282882e9a2 Mon Sep 17 00:00:00 2001 From: Leonardo Giordani Date: Tue, 23 Jun 2020 14:56:51 +0100 Subject: [PATCH] Changed example DATABASE_URI values --- docs/config.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index f02702b2..f1f35be3 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -552,17 +552,21 @@ and import different hard-coded files based on that. An interesting pattern is also to use classes and inheritance for configuration:: + import os + + basedir = os.path.abspath(os.path.dirname(__file__)) + class Config(object): TESTING = False - DATABASE_URI = 'sqlite:///:memory:' class ProductionConfig(Config): DATABASE_URI = 'mysql://user@localhost/foo' class DevelopmentConfig(Config): - pass + DATABASE_URI = "sqlite:///" + os.path.join(basedir, "foo.db") class TestingConfig(Config): + DATABASE_URI = 'sqlite:///:memory:' TESTING = True To enable such a config you just have to call into