Changed example DATABASE_URI values
This commit is contained in:
parent
aec07a1cb5
commit
efbd721f20
1 changed files with 6 additions and 2 deletions
|
|
@ -552,17 +552,21 @@ and import different hard-coded files based on that.
|
||||||
An interesting pattern is also to use classes and inheritance for
|
An interesting pattern is also to use classes and inheritance for
|
||||||
configuration::
|
configuration::
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
TESTING = False
|
TESTING = False
|
||||||
DATABASE_URI = 'sqlite:///:memory:'
|
|
||||||
|
|
||||||
class ProductionConfig(Config):
|
class ProductionConfig(Config):
|
||||||
DATABASE_URI = 'mysql://user@localhost/foo'
|
DATABASE_URI = 'mysql://user@localhost/foo'
|
||||||
|
|
||||||
class DevelopmentConfig(Config):
|
class DevelopmentConfig(Config):
|
||||||
pass
|
DATABASE_URI = "sqlite:///" + os.path.join(basedir, "foo.db")
|
||||||
|
|
||||||
class TestingConfig(Config):
|
class TestingConfig(Config):
|
||||||
|
DATABASE_URI = 'sqlite:///:memory:'
|
||||||
TESTING = True
|
TESTING = True
|
||||||
|
|
||||||
To enable such a config you just have to call into
|
To enable such a config you just have to call into
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue