diff --git a/yadc/__init__.py b/yadc/__init__.py index 8acf90d..04a9a31 100644 --- a/yadc/__init__.py +++ b/yadc/__init__.py @@ -21,25 +21,8 @@ assets = AssetsEnvironment() def create_app(): app = Flask(__name__, instance_relative_config=True) - app.config.from_pyfile('config.py') - app.config.from_mapping(POST_UPLOADS=os.path.join(app.instance_path, 'post'), SQLALCHEMY_TRACK_MODIFICATIONS=False) - # app.config.from_mapping( - # SECRET_KEY='dev', - # #SQLALCHEMY_DATABASE_URI='sqlite:///{}'.format(os.path.join(app.instance_path, 'yadc.db')), - # SQLALCHEMY_DATABASE_URI='postgresql://{}:{}@{}:{}/{}'.format('yadc', 'omegalul', 'localhost', 5432, 'yadc'), - # MAX_CONTENT_LENGTH=10*1024*1024, - # POST_LIST_THUMB_HEIGHT=200, - # POST_UPLOADS=os.path.join(app.instance_path, 'post'), - # INSTANCE_NAME='Darkne.su', - # POSTS_PER_PAGE=8, - # MANAGE_USERS_PER_PAGE=2, - # MANAGE_POSTS_PER_PAGE=2, - - # ALLOW_REGISTER=False, - - # SQLALCHEMY_ECHO=True, - # ) + app.config.from_mapping(POST_UPLOADS=os.path.join(app.instance_path, 'post'), SQLALCHEMY_TRACK_MODIFICATIONS=False) try: os.makedirs(app.instance_path) @@ -51,6 +34,9 @@ def create_app(): except OSError: pass + app.config.from_pyfile('config.py') + + db.init_app(app) migrate.init_app(app, db) login.init_app(app)