From 5805c0ba0fc0e405404616c40dc39954cb3f8c6a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 14 Sep 2021 15:53:01 +0200 Subject: [PATCH] fd --- files/__main__.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/files/__main__.py b/files/__main__.py index 4bbf7a457..426167f30 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -8,6 +8,7 @@ from flask_limiter import Limiter from flask_compress import Compress from flask_limiter.util import get_ipaddr from flaskext.markdown import Markdown +from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, scoped_session, Query as _Query from sqlalchemy import * from sqlalchemy.pool import QueuePool @@ -65,10 +66,8 @@ app.config["RATELIMIT_DEFAULTS_EXEMPT_WHEN"]=lambda:False app.config["RATELIMIT_HEADERS_ENABLED"]=True redispool=ConnectionPool(max_connections=app.config["REDIS_POOL_SIZE"], host=app.config["CACHE_REDIS_URL"][8:]) - app.config["CACHE_OPTIONS"]={'connection_pool':redispool} - Markdown(app) cache = Cache(app) Compress(app) @@ -115,9 +114,10 @@ class RetryingQuery(_Query): def first(self): return super().first() - db_session=scoped_session(sessionmaker(bind=_engine, query_cls=RetryingQuery)) +Base = declarative_base() + #set the shared redis cache for misc stuff @@ -129,10 +129,6 @@ r=redis.Redis( ) if app.config["CACHE_REDIS_URL"] else None - -# import and bind all routing functions -from files.routes import * - # enforce https @app.before_request def before_request(): @@ -186,4 +182,7 @@ def after_request(response): response.headers.add("Feature-Policy", "geolocation 'none'; midi 'none'; notifications 'none'; push 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; vibrate 'none'; fullscreen 'none'; payment 'none';") response.headers.add("X-Frame-Options", "deny") - return response \ No newline at end of file + return response + +# import and bind all routing functions +from files.routes import * \ No newline at end of file