Add postgresql database

This commit is contained in:
Stephan Porada
2019-09-05 14:43:36 +02:00
parent 3b57211da9
commit 8d7f053a4c
4 changed files with 42 additions and 4 deletions

View File

@ -24,8 +24,16 @@ class Config:
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir,
'data_dev.sqlite')
# SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir,
# 'data_dev.sqlite')
SQLALCHEMY_DATABASE_URI = \
'postgresql+psycopg2://{user}:{passwd}@{host}:{port}/{db}'.format(
user=os.environ.get('POSTGRES_USER'),
passwd=os.environ.get('POSTGRES_PASSWORD'),
host=os.environ.get('POSTGRES_HOST'),
port=os.environ.get('POSTGRES_PORT'),
db=os.environ.get('POSTGRES_DB_NAME'))
print(SQLALCHEMY_DATABASE_URI)
class TestingConfig(Config):
@ -41,7 +49,7 @@ class TestingConfig(Config):
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
# 'production': ProductionConfig,
#'production': ProductionConfig,
'default': DevelopmentConfig
}