2023-07-11 14:23:48 +00:00
|
|
|
from aioflask import Flask
|
|
|
|
from flask_caching import Cache
|
|
|
|
|
|
|
|
from functools import wraps
|
|
|
|
|
2023-07-15 12:01:35 +00:00
|
|
|
from proxify import Asgiproxify
|
|
|
|
|
2023-07-11 14:23:48 +00:00
|
|
|
def awaitify(sync_func):
|
|
|
|
"""Wrap a synchronous callable to allow ``await``'ing it"""
|
|
|
|
@wraps(sync_func)
|
|
|
|
async def async_func(*args, **kwargs):
|
|
|
|
return sync_func(*args, **kwargs)
|
|
|
|
return async_func
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
2023-07-15 12:01:35 +00:00
|
|
|
proxified = Asgiproxify(app)
|
2023-07-11 14:23:48 +00:00
|
|
|
|
2023-07-12 14:52:47 +00:00
|
|
|
######################################################################
|
|
|
|
|
2023-07-15 12:01:35 +00:00
|
|
|
host = 'localhost'
|
|
|
|
port = 8885
|
2023-07-12 14:52:47 +00:00
|
|
|
|
|
|
|
should_fetch_comments = True
|
2023-07-15 12:01:35 +00:00
|
|
|
|
|
|
|
app.config['DEBUG'] = False
|
|
|
|
app.config['TESTING'] = False
|
2023-07-12 14:52:47 +00:00
|
|
|
|
|
|
|
######################################################################
|
2023-07-11 14:23:48 +00:00
|
|
|
|
2023-07-24 07:00:19 +00:00
|
|
|
app.config['CACHE_DEFAULT_TIMEOUT'] = 60
|
|
|
|
|
|
|
|
#app.config['CACHE_TYPE'] = 'RedisCache'
|
2023-07-11 14:23:48 +00:00
|
|
|
app.config['CACHE_TYPE'] = 'SimpleCache'
|
2023-07-24 07:00:19 +00:00
|
|
|
|
2023-07-11 14:23:48 +00:00
|
|
|
cache = Cache(app)
|