Merge pull request #344 from atbentley/docs
Update blueprints docs with correct listener example
This commit is contained in:
commit
5ddc166b12
|
@ -107,13 +107,13 @@ Available events are:
|
||||||
```python
|
```python
|
||||||
bp = Blueprint('my_blueprint')
|
bp = Blueprint('my_blueprint')
|
||||||
|
|
||||||
@bp.listen('before_server_start')
|
@bp.listener('before_server_start')
|
||||||
async def setup_connection():
|
async def setup_connection(app, loop):
|
||||||
global database
|
global database
|
||||||
database = mysql.connect(host='127.0.0.1'...)
|
database = mysql.connect(host='127.0.0.1'...)
|
||||||
|
|
||||||
@bp.listen('after_server_stop')
|
@bp.listener('after_server_stop')
|
||||||
async def close_connection():
|
async def close_connection(app, loop):
|
||||||
await database.close()
|
await database.close()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user