From a9111aefd3ba7fa13f18926de2de9d835ba5e43f Mon Sep 17 00:00:00 2001 From: "Sachin S. Kamath" <sskamath96@gmail.com> Date: Thu, 19 Oct 2017 19:32:55 +0530 Subject: [PATCH] Add instance and config Signed-off-by: Sachin S. Kamath <sskamath96@gmail.com> --- .gitignore | 2 +- instance/__init__.py | 1 + instance/config.py | 48 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 instance/__init__.py create mode 100644 instance/config.py diff --git a/.gitignore b/.gitignore index 248fb04..26e723d 100644 --- a/.gitignore +++ b/.gitignore @@ -57,7 +57,7 @@ coverage.xml local_settings.py # Flask stuff: -instance/ +migrations/ .webassets-cache # Scrapy stuff: diff --git a/instance/__init__.py b/instance/__init__.py new file mode 100644 index 0000000..9bad579 --- /dev/null +++ b/instance/__init__.py @@ -0,0 +1 @@ +# coding=utf-8 diff --git a/instance/config.py b/instance/config.py new file mode 100644 index 0000000..0cd5642 --- /dev/null +++ b/instance/config.py @@ -0,0 +1,48 @@ +# coding=utf-8 +import os + + +class Config(object): + """Parent configuration class.""" + DEBUG = False + CSRF_ENABLED = True + TESTING = False + SECRET = os.getenv('SECRET') + SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL') + + +class DevelopmentConfig(Config): + """Configurations for Development.""" + DEBUG = False + SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/test_db' + SECRET = "ChangeThisStringIfYouWant" + TESTING = False + + +class TestingConfig(Config): + """Configurations for Testing, with a separate test database.""" + TESTING = True + SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/test_db' + DEBUG = True + SECRET = 'ChangeMeMaybe' + + +class StagingConfig(Config): + """Configurations for Staging.""" + DEBUG = True + + +class ProductionConfig(Config): + """Configurations for Production.""" + DEBUG = False + TESTING = False + SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/hodor_prod' + SECRET = "TODO: ChangeMeInProduction" + + +app_config = { + 'development': DevelopmentConfig, + 'testing': TestingConfig, + 'staging': StagingConfig, + 'production': ProductionConfig, +} \ No newline at end of file -- GitLab