-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92bcec9
commit 93b6d72
Showing
3 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
# signals | ||
# Signals | ||
|
||
Run code when certain events happen. | ||
|
||
```python | ||
from bolt.signals import request_finished | ||
|
||
|
||
def on_request_finished(sender, **kwargs): | ||
print("Request finished!") | ||
|
||
|
||
request_finished.connect(on_request_finished) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Templates | ||
|
||
Render HTML templates using Jinja. | ||
|
||
Templates are typically rendered in `TemplateViews`, | ||
but you can also render them directly to strings for emails or other use cases. | ||
|
||
```python | ||
from bolt.templates import Template | ||
|
||
|
||
Template("comment.md").render({ | ||
"message": "Hello, world!", | ||
}) | ||
``` | ||
|
||
Template files can be located in either a root `app/templates`, | ||
or the `templates` directory in any installed packages. | ||
|
||
[Customizing Jinja](./jinja/README.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters