forked from orbit-oss/flask
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
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue