52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
# -*- encoding: utf-8 -*-
|
|
"""
|
|
Copyright (c) 2019 - present AppSeed.us
|
|
"""
|
|
|
|
import os
|
|
from decouple import config
|
|
import logging
|
|
|
|
class Config(object):
|
|
|
|
LOGGING_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
|
LOGGING_LOCATION = "bookshelf.log"
|
|
LOGGING_LEVEL = logging.DEBUG
|
|
|
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
# Set up the App SECRET_KEY
|
|
SECRET_KEY = config('SECRET_KEY', default='S#perS3crEt_007')
|
|
|
|
# This will create a file in <app> FOLDER
|
|
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'db.sqlite3')
|
|
# SQLALCHEMY_DATABASE_URI = "postgresql://postgres:mypassword@localhost:5432/bbbb"
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|
|
|
class ProductionConfig(Config):
|
|
DEBUG = False
|
|
|
|
# Security
|
|
SESSION_COOKIE_HTTPONLY = True
|
|
REMEMBER_COOKIE_HTTPONLY = True
|
|
REMEMBER_COOKIE_DURATION = 3600
|
|
|
|
# PostgreSQL database
|
|
SQLALCHEMY_DATABASE_URI = '{}://{}:{}@{}:{}/{}'.format(
|
|
config( 'DB_ENGINE' , default='postgresql' ),
|
|
config( 'DB_USERNAME' , default='postgres' ),
|
|
config( 'DB_PASS' , default='password' ),
|
|
config( 'DB_HOST' , default='localhost' ),
|
|
config( 'DB_PORT' , default=5432 ),
|
|
config( 'DB_NAME' , default='appseed-flask' )
|
|
)
|
|
|
|
class DebugConfig(Config):
|
|
DEBUG = True
|
|
|
|
# Load all possible configurations
|
|
config_dict = {
|
|
'Production': ProductionConfig,
|
|
'Debug' : DebugConfig
|
|
}
|