diff --git a/app/__init__.py b/app/__init__.py index e6fade9..a9c55b5 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,11 +1,11 @@ from flask import Flask -from config import Config +from config import config from app.blueprints import blueprints from app.extensions import db, migrate from app.celery import celery_init_app -def create_app(config_class=Config): +def create_app(config_class=config): app = Flask(__name__) app.config.from_object(config_class) diff --git a/config.py b/config.py index 498564d..cddcf06 100644 --- a/config.py +++ b/config.py @@ -2,8 +2,8 @@ import os basedir = os.path.abspath(os.path.dirname(__file__)) -class Config: - SECRET_KEY = os.environ.get('SECRET_KEY') + +class ProductionConfig: SQLALCHEMY_DATABASE_URI = f"postgresql://{os.environ.get('POSTGRES_USER')}:{os.environ.get('POSTGRES_PASSWORD')}@postgres/{os.environ.get('POSTGRES_DB')}" SQLALCHEMY_TRACK_MODIFICATIONS = False CELERY = dict( @@ -12,3 +12,13 @@ class Config: task_ignore_result=True, ) +class DebugConfig: + SQLALCHEMY_DATABASE_URI = f"postgresql://postgres:123456789@localhost:5432/paper" + SQLALCHEMY_TRACK_MODIFICATIONS = False + CELERY = dict( + broker_url="redis://localhost:6379/0", + result_backend="redis://localhost:6379/0", + task_ignore_result=True, + ) + +config = DebugConfig \ No newline at end of file