mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-11 13:37:22 +00:00

- introduce flask cache - use replaceAll together with encodeURI component on client - many more
24 lines
407 B
Python
24 lines
407 B
Python
from flask import Flask
|
|
from flask_cors import CORS
|
|
|
|
from flask_caching import Cache
|
|
|
|
config = {
|
|
"CACHE_TYPE": "SimpleCache",
|
|
"CACHE_DEFAULT_TIMEOUT": 300
|
|
}
|
|
|
|
cache = Cache(config = config)
|
|
|
|
def create_app():
|
|
app = Flask(__name__)
|
|
CORS(app)
|
|
|
|
app.config.from_mapping(config)
|
|
cache.init_app(app)
|
|
|
|
from . import api
|
|
app.register_blueprint(api.bp, url_prefix='/')
|
|
|
|
return app
|