forked from rDrama/rDrama
master
parent
8ca033a6ac
commit
5805c0ba0f
|
@ -8,6 +8,7 @@ from flask_limiter import Limiter
|
||||||
from flask_compress import Compress
|
from flask_compress import Compress
|
||||||
from flask_limiter.util import get_ipaddr
|
from flask_limiter.util import get_ipaddr
|
||||||
from flaskext.markdown import Markdown
|
from flaskext.markdown import Markdown
|
||||||
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.orm import sessionmaker, scoped_session, Query as _Query
|
from sqlalchemy.orm import sessionmaker, scoped_session, Query as _Query
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.pool import QueuePool
|
from sqlalchemy.pool import QueuePool
|
||||||
|
@ -65,10 +66,8 @@ app.config["RATELIMIT_DEFAULTS_EXEMPT_WHEN"]=lambda:False
|
||||||
app.config["RATELIMIT_HEADERS_ENABLED"]=True
|
app.config["RATELIMIT_HEADERS_ENABLED"]=True
|
||||||
|
|
||||||
redispool=ConnectionPool(max_connections=app.config["REDIS_POOL_SIZE"], host=app.config["CACHE_REDIS_URL"][8:])
|
redispool=ConnectionPool(max_connections=app.config["REDIS_POOL_SIZE"], host=app.config["CACHE_REDIS_URL"][8:])
|
||||||
|
|
||||||
app.config["CACHE_OPTIONS"]={'connection_pool':redispool}
|
app.config["CACHE_OPTIONS"]={'connection_pool':redispool}
|
||||||
|
|
||||||
|
|
||||||
Markdown(app)
|
Markdown(app)
|
||||||
cache = Cache(app)
|
cache = Cache(app)
|
||||||
Compress(app)
|
Compress(app)
|
||||||
|
@ -115,9 +114,10 @@ class RetryingQuery(_Query):
|
||||||
def first(self):
|
def first(self):
|
||||||
return super().first()
|
return super().first()
|
||||||
|
|
||||||
|
|
||||||
db_session=scoped_session(sessionmaker(bind=_engine, query_cls=RetryingQuery))
|
db_session=scoped_session(sessionmaker(bind=_engine, query_cls=RetryingQuery))
|
||||||
|
|
||||||
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
||||||
#set the shared redis cache for misc stuff
|
#set the shared redis cache for misc stuff
|
||||||
|
|
||||||
|
@ -129,10 +129,6 @@ r=redis.Redis(
|
||||||
) if app.config["CACHE_REDIS_URL"] else None
|
) if app.config["CACHE_REDIS_URL"] else None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# import and bind all routing functions
|
|
||||||
from files.routes import *
|
|
||||||
|
|
||||||
# enforce https
|
# enforce https
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def before_request():
|
def before_request():
|
||||||
|
@ -187,3 +183,6 @@ def after_request(response):
|
||||||
response.headers.add("X-Frame-Options", "deny")
|
response.headers.add("X-Frame-Options", "deny")
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
# import and bind all routing functions
|
||||||
|
from files.routes import *
|
Loading…
Reference in New Issue