File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -15,16 +15,21 @@ INSTALLATION
1515------------
1616
17171. Install flask replicated distribution using ``pip install flask_replicated ``.
18+ Or add ``flask-replicated==1.4 `` in requirements.txt and requirements
19+ ``pip3 install -r requirements.txt ``.
1820
19- 2. In flask ``app.config `` configure your database bindings a standard way::
21+ 2. Import library ``from flask_replicated import FlaskReplicated `` or
22+ ``import flask_replicated `` depending on how you want to call the functions or decorators
23+
24+ 3. In flask ``app.config `` configure your database bindings a standard way::
2025
2126 SQLALCHEMY_DATABASE_URI = '%(schema)s://%(user)s:%(password)s@%(master_host)s/%(database)s'
2227 SQLALCHEMY_BINDS = {
2328 'master': SQLALCHEMY_DATABASE_URI,
2429 'slave': '%(schema)s://%(user)s:%(password)s@%(slave_host)s/%(database)s'
2530 }
2631
27- 3 . Register app extension::
32+ 4 . Register app extension::
2833
2934 app = Flask(...)
3035 ...
@@ -48,7 +53,7 @@ To handle these situations wrap appropriate view function with
4853``@flask_replicated.changes_database `` decorator. It will mark function to
4954always use master database url.
5055
51- Conversely, wrap the view function with the ``@use_slave_database ``
56+ Conversely, wrap the view function with the ``@flask_replicated. use_slave_database ``
5257decorator if you want to ensure that it always uses the slave replica.
5358
5459GET after POST
You can’t perform that action at this time.
0 commit comments