From 9ab0e87ab7f016cea5b12f9dd96af00b561a8493 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Mon, 15 Mar 2021 14:44:07 +0300 Subject: Delete redundant gn3/config.py All default confs should go to one place: gn3/setting.py * gn3/app.py: Delete get_config. Apply pep-8 formatting. * gn3/config.py: Delete it. Move conf options to... * gn3/settings.py: ... here. --- gn3/app.py | 7 +------ gn3/config.py | 16 ---------------- gn3/settings.py | 5 +++++ 3 files changed, 6 insertions(+), 22 deletions(-) delete mode 100644 gn3/config.py (limited to 'gn3') diff --git a/gn3/app.py b/gn3/app.py index c912ed9..a684d25 100644 --- a/gn3/app.py +++ b/gn3/app.py @@ -4,7 +4,6 @@ import os from typing import Dict from typing import Union from flask import Flask -from gn3.config import get_config from gn3.api.gemma import gemma from gn3.api.general import general from gn3.api.correlation import correlation @@ -16,10 +15,6 @@ def create_app(config: Union[Dict, str, None] = None) -> Flask: # Load default configuration app.config.from_object("gn3.settings") - my_config = get_config() - - app.config.from_object(my_config["dev"]) - # Load environment configuration if "GN3_CONF" in os.environ: app.config.from_envvar('GN3_CONF') @@ -32,5 +27,5 @@ def create_app(config: Union[Dict, str, None] = None) -> Flask: app.config.from_pyfile(config) app.register_blueprint(general, url_prefix="/api/") app.register_blueprint(gemma, url_prefix="/api/gemma") - app.register_blueprint(correlation,url_prefix="/api/correlation") + app.register_blueprint(correlation, url_prefix="/api/correlation") return app diff --git a/gn3/config.py b/gn3/config.py deleted file mode 100644 index 9c6ec34..0000000 --- a/gn3/config.py +++ /dev/null @@ -1,16 +0,0 @@ -class Config: - DEBUG = True - Testing = False - - -class DevConfig(Config): - Testing = True - SQLALCHEMY_DATABASE_URI = "mysql://kabui:1234@localhost/test" - SECRET_KEY = "password" - SQLALCHEMY_TRACK_MODIFICATIONS = False - - -def get_config(): - return { - "dev": DevConfig - } diff --git a/gn3/settings.py b/gn3/settings.py index f5988bb..c09e6e0 100644 --- a/gn3/settings.py +++ b/gn3/settings.py @@ -10,3 +10,8 @@ GENODIR = "" REDIS_URI = "redis://localhost:6379/0" REDIS_JOB_QUEUE = "GN3::job-queue" TMPDIR = os.environ.get("TMPDIR", tempfile.gettempdir()) + +# SQL confs +SQLALCHEMY_DATABASE_URI = "mysql://kabui:1234@localhost/test" +SECRET_KEY = "password" +SQLALCHEMY_TRACK_MODIFICATIONS = False -- cgit v1.2.3