July 2018
Intermediate to advanced
324 pages
8h 14m
English
In the config package, we defined the application level configuration, which would be isolated as per the defined environment. The following is the content of the config.py file.
File—config/config.py:
import osfrom shutil import copyfileBASE_DIR = os.path.dirname(os.path.dirname(__file__))def get_sqlite_uri(db_name): src = os.path.join(BASE_DIR, db_name) dst = "/tmp/%s" % db_name copyfile(src, dst) return 'sqlite:///%s' % dstclass Config(object): SECRET_KEY = os.environ.get('SECRET_KEY') or os.urandom(24) SQLALCHEMY_COMMIT_ON_TEARDOWN = True SQLALCHEMY_RECORD_QUERIES = True SQLALCHEMY_TRACK_MODIFICATIONS = False @staticmethod def init_app(app): passclass DevelopmentConfig(Config): DEBUG = True BUNDLE_ERRORS ...Read now
Unlock full access