-
Notifications
You must be signed in to change notification settings - Fork 53
Configuration
aaajiulong edited this page Apr 25, 2021
·
6 revisions
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yoobool/[email protected]/packages/flask-state.min.css">
<script src="https://cdn.jsdelivr.net/gh/yoobool/[email protected]/packages/umd/flask-state.min.js"></script>
<script type="text/javascript">
flaskState.init({dom:document.getElementById('test')});
</script>
app.config['REDIS_CONF'] = {'REDIS_STATUS': True, 'REDIS_HOST': '192.168.1.1', 'REDIS_PORT':16380, 'REDIS_PASSWORD': 'psw'}
# The default interval and minimum interval are both 60 seconds
import flask_state
SECS = 60
flask_state.init_app(app, SECS)
import flask_state
import logging
custom_logger = logging.getLogger(__name__)
flask_state.init_app(app, interval=60, log_instance=custom_logger)
/* When the initialization plug-in does not pass in an object, the plug-in will automatically create a right-hand suspension ball
Note: all pages share a plug-in instance. Multiple Dom elements bound to the init method trigger the same instance */
flaskState.init();
<!--Note: the language pack must be loaded after the introduction of the Flask-State main file -->
<!-- CDN -->
<script src="https://cdn.jsdelivr.net/gh/yoobool/[email protected]/packages/umd/flask-state.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/yoobool/[email protected]/packages/umd/zh.js"></script>
<script type="text/javascript">
flaskState.init({lang:flaskState.zh});
</script>
/* webpack */
import {init} from 'flask-state';
import {zh} from 'flask-state/i18n.js';
init({lang:zh});