-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.py
50 lines (39 loc) · 1.48 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
import os
import decouple
from pathlib import Path
class Config(object):
basedir = os.path.abspath(os.path.dirname(__file__))
# Set up the App SECRET_KEY
SECRET_KEY = decouple.config('SECRET_KEY', default='S#perS3crEt_007')
# This will create a file in <app> FOLDER
_db_path = Path(basedir, 'db-data')
_db_path.mkdir(parents=True, exist_ok=True)
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + str(_db_path / 'db.sqlite3')
SQLALCHEMY_TRACK_MODIFICATIONS = False
DEFAULT_SERVER = decouple.config('DEFAULT_SERVER', default='https://staging.qcarchive.molssi.org')
class ProductionConfig(Config):
DEBUG = False
# Security
SESSION_COOKIE_HTTPONLY = True
REMEMBER_COOKIE_HTTPONLY = True
REMEMBER_COOKIE_DURATION = 3600
# PostgreSQL database
SQLALCHEMY_DATABASE_URI = '{}://{}:{}@{}:{}/{}'.format(
decouple.config( 'DB_ENGINE' , default='postgresql' ),
decouple.config( 'DB_USERNAME' , default='appseed' ),
decouple.config( 'DB_PASS' , default='pass' ),
decouple.config( 'DB_HOST' , default='localhost' ),
decouple.config( 'DB_PORT' , default=5432 ),
decouple.config( 'DB_NAME' , default='appseed-flask' )
)
class DebugConfig(Config):
DEBUG = True
# Load all possible configurations
config_dict = {
'Production': ProductionConfig,
'Debug' : DebugConfig
}